Conexao Java: Criando uma App Android
Upcoming SlideShare
Loading in...5
×
 

Conexao Java: Criando uma App Android

on

  • 5,564 views

Palestra do Conexão Java 2012 relativa a criação de uma App Mobile.

Palestra do Conexão Java 2012 relativa a criação de uma App Mobile.

Statistics

Views

Total Views
5,564
Views on SlideShare
5,563
Embed Views
1

Actions

Likes
5
Downloads
98
Comments
0

1 Embed 1

http://127.0.0.1 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Conexao Java: Criando uma App Android Conexao Java: Criando uma App Android Presentation Transcript

  • Monday, May 28, 12
  • Erich Egert Instrutor e desenvolvedor pela Caelum encontre-me: @erichegt github.com/erichegtMonday, May 28, 12
  • ErissssshhhhhhMonday, May 28, 12
  • Monday, May 28, 12
  • Criando uma appMonday, May 28, 12
  • Por quê Android?Monday, May 28, 12
  • 112.5 75 37.5 0 2006 2007 2008 2009 2010 2011 Palm/webOS Symbian Windows Mobile Windows Phone 7 RIM IOS AndroidMonday, May 28, 12
  • Monday, May 28, 12
  • Monday, May 28, 12
  • Razões do sucesso?Monday, May 28, 12
  • Monday, May 28, 12
  • Monday, May 28, 12
  • Monday, May 28, 12
  • + ADTMonday, May 28, 12
  • public class Onibus { private String nome; private String linha; //... }Monday, May 28, 12
  • public class Onibus { private String nome; private String linha; //... } Jar JVMMonday, May 28, 12
  • public class Onibus { private String nome; private String linha; //... } Jar APK JVM DalvikMonday, May 28, 12
  • Vários dispositivosMonday, May 28, 12
  • Único Só pode haver um! APK Vários dispositivosMonday, May 28, 12
  • Adapter AsyncTask LayoutInflater LocationManager MapActivity ExpandableListViewMonday, May 28, 12
  • Monday, May 28, 12
  • Vamos começar devagar...Monday, May 28, 12
  • Emulador!!Monday, May 28, 12
  • Olá Mundo!Monday, May 28, 12
  • Hands on!Monday, May 28, 12
  • AndroidManifest.xml main.xml ? OlaMundoActivity Entendendo...Monday, May 28, 12
  • Estrutura do ProjetoMonday, May 28, 12
  • res drawable layout valuesMonday, May 28, 12
  • res drawable layout valuesMonday, May 28, 12
  • res drawable layout valuesMonday, May 28, 12
  • res drawable <resources> ... <string name="cor">COR:</string> <string name="modelo">MODELO:</string> <string name="opcionais">OPCIONAIS:</string> layout <string name="salvar">SALVAR</string> </resources> valuesMonday, May 28, 12
  • Monday, May 28, 12
  • Tamanho? wrap_content fill_parentMonday, May 28, 12
  • Manipulando a telaMonday, May 28, 12
  • Activity comportamento public class OnibusActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); //muitas coisas legais aqui! } }Monday, May 28, 12
  • XML Activity aparência comportamento public class OnibusActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); //muitas coisas legais aqui! } }Monday, May 28, 12
  • Activity XML onCreate( ) findViewById( )Monday, May 28, 12
  • Activity XML onCreate( ) findViewById( )Monday, May 28, 12
  • Hands on!Monday, May 28, 12
  • Listagem?Monday, May 28, 12
  • ListViewMonday, May 28, 12
  • Como? List<PontoDeOnibus>Monday, May 28, 12
  • Adapter Objeto ViewMonday, May 28, 12
  • List<PontoDeOnibus> dados new ArrayAdapter<PontoDeOnibus>(context, layout, lista); Activity layoutMonday, May 28, 12
  • layout linha.xmlMonday, May 28, 12
  • Hands on!Monday, May 28, 12
  • O visual é importante!Monday, May 28, 12
  • Hands on!Monday, May 28, 12
  • Tudo espalhado?Monday, May 28, 12
  • styles.xmlMonday, May 28, 12
  • Hands on!Monday, May 28, 12
  • E se...Monday, May 28, 12
  • Monday, May 28, 12
  • Tem como?!Monday, May 28, 12
  • SIM!!!Monday, May 28, 12
  • Application ResourcesMonday, May 28, 12
  • Hands on!Monday, May 28, 12
  • Monday, May 28, 12
  • Monday, May 28, 12
  • JSONMonday, May 28, 12
  • String json = //...Monday, May 28, 12
  • INTERNETMonday, May 28, 12
  • INTERNETMonday, May 28, 12
  • INTERNET AndroidManifest.xmlMonday, May 28, 12
  • INTERNET AndroidManifest.xmlMonday, May 28, 12
  • A reposta do server?Monday, May 28, 12
  • { JSON!! "linha": "1018-10", "nome": "Vila Rosa - Metrô Santana", "pontos" : [ { "nome": "920016054", "descricao": "R. Dr. Neto De Araujo, 311", "coordenada": { "latitude": -23.5876, "longitude": -46.6321 } }, { "nome": "920016364", "descricao": "R.Vergueiro, 3039", "coordenada": { "latitude": -23.5875, "longitude": -46.6336 } } ] }Monday, May 28, 12
  • JSON ???? objeto ÔnibusMonday, May 28, 12
  • Quem poderá nos ajudar?Monday, May 28, 12
  • Mark Murphy - The Commons Guy Bibliotecas Marotas!Monday, May 28, 12
  • JSON public class Onibus { private String nome; private String linha; objeto private List<Ponto> pontos; Ônibus //... }Monday, May 28, 12
  • JSON GSON public class Onibus { private String nome; private String linha; objeto private List<Ponto> pontos; Ônibus //... }Monday, May 28, 12
  • gson.jar libsMonday, May 28, 12
  • String json = //...Monday, May 28, 12
  • String json = //... Gson gson = new GsonBuilder().create();Monday, May 28, 12
  • String json = //... Gson gson = new GsonBuilder().create(); Onibus busao = gson.fromJson(json,Onibus.class);Monday, May 28, 12
  • Hands on!Monday, May 28, 12
  • Próximo desafio?Monday, May 28, 12
  • Mapa?!?Monday, May 28, 12
  • Tem como?!?Monday, May 28, 12
  • MapActivityMonday, May 28, 12
  • ItemizedOverlay PontoDeOnibus OverlayItem Coordenada GeoPointMonday, May 28, 12
  • Onde fazer a conversão? Coordenada GeoPointMonday, May 28, 12
  • Utils?!Monday, May 28, 12
  • Ensinamentos do Aniche SkywalkerMonday, May 28, 12
  • public class Ponto { //... public OverlayItem toOverlayItem() { return new OverlayItem( this.localizacao.toGeoPoint(), "Localização:", this.descricao ); } } public class Coordenada { private static final double CONVERSION_SCALE = 1E6; //... public GeoPoint toGeoPoint() { Double geoLat = this.latitude * CONVERSION_SCALE; Double geoLng = this.longitude * CONVERSION_SCALE; return new GeoPoint(geoLat.intValue(), geoLng.intValue()); } }Monday, May 28, 12
  • Vamos testar??Monday, May 28, 12
  • Hands on!Monday, May 28, 12
  • instale! confira o código fonte! github/caelum/onibus-androidMonday, May 28, 12
  • instale! confira o código fonte! github/caelum/onibus-android Também na versão github/caelum/onibus-iosMonday, May 28, 12
  • OBRIGADO! @erichegt github.com/erichegtMonday, May 28, 12
  • Activity ActivityMonday, May 28, 12
  • Activity ActivityMonday, May 28, 12
  • INTENT! Activity ActivityMonday, May 28, 12