ANdroid - Rest Services I need to invoke a restful service after clicking on a record in the ListView. The application restarts without marking error. If this event is handled by a button, it correctly consumes the service. They can help me see what I'm doing wrong, I can not identify what it is !!
public ListView epclist;
onCreate
.
.
epclist.setOnItemClickListener(new OnItemClickListener()
{
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3)
{
buscarTag(arg1,"2DEC14DC6496B100000000E3");
}
});
.
.
end onCreate
public void buscarTag(View view,String tag) {
String url = String.format("http://192.168.1.66:9090/miservicio/rest/rfid/getTickets/2DEC14DC6496B100000000E3");
new LoadFilmTask().execute(url);
}
private class LoadFilmTask extends AsyncTask<String, Long, String> {
protected String doInBackground(String... urls) {
try {
return HttpRequest.get(urls[0]).accept("application/json")
.body();
} catch (Exception exception) {
return null;
}
}
protected void onPostExecute(String response) {
respuesta =response;
}
}