Curso-Android-Desarrollo-de-Aplicaciones-Móviles
Curso-Android-Desarrollo-de-Aplicaciones-Móviles
Curso-Android-Desarrollo-de-Aplicaciones-Móviles
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
CURSO ANDROID<br />
130<br />
HttpRequestFactory factory = transport.createRequestFactory(new<br />
HttpRequestInitializer() {<br />
@Overri<strong>de</strong><br />
public void initialize(HttpRequest request) {<br />
JsonCParser parser = new JsonCParser();<br />
parser.jsonFactory = jsonFactory;<br />
request.addParser(parser);<br />
GoogleHea<strong>de</strong>rs hea<strong>de</strong>rs = new GoogleHea<strong>de</strong>rs();<br />
hea<strong>de</strong>rs.setApplicationName(“Maestros-Del-Web-<strong>Android</strong>/1.0”);<br />
hea<strong>de</strong>rs.gdataVersion = “2”;<br />
request.hea<strong>de</strong>rs = hea<strong>de</strong>rs;<br />
}});<br />
try {<br />
HttpRequest request = factory.buildGetRequest(url);<br />
final Vi<strong>de</strong>oFeed feed =<br />
request.execute().parseAs(Vi<strong>de</strong>oFeed.class);<br />
ListView vi<strong>de</strong>oList = (ListView)findViewById(R.id.lstVi<strong>de</strong>o);<br />
ArrayAdapter adpList = new ArrayAdapter<br />
(getApplicationContext(),android.R.layout.simple_list_item_1,feed.items);<br />
vi<strong>de</strong>oList.setAdapter(adpList);<br />
vi<strong>de</strong>oList.setOnItemClickListener(new OnItemClickListener() {<br />
@Overri<strong>de</strong><br />
public void onItemClick(AdapterView arg0,<br />
View arg1, int position, long arg3) {<br />
Vi<strong>de</strong>o item = feed.items.get(position);<br />
startActivity(new Intent(Intent.ACTION_VIEW,<br />
Uri.parse(item.player.mobile)));<br />
}});<br />
} catch (IOException e) {<br />
e.printStackTrace();<br />
}}<br />
});<br />
}<br />
Al ejecutar nuestra aplicación, probamos individualmente cada una <strong>de</strong> las 2 partes, primero la traduc-