Http Client and Async Task - ANDROID

Asked

Viewed 153 times

0

Speak, people, I wonder if anyone can help me, I’m new in mobile I’m starting with Android. I’m making a request with HTTP CLIENT to return all the value of the page, be it web or mine local host. However before I was making the call from my method that returns this data (method I created) within the onCreate() main function, but after a few seconds, if you pass there for 3 or 5 seconds the request may crash so I’m trying to use the Async Task to execute my method that returns the content of the request, inside the method of the Ackground() of my sub class Pegaurl that is within my main Mainactivity class.

The problem that with my emulator in version 2.3.3 or 2.3.1 or 2.3 it works perfectly, however when running in version 4.0 or 4.4 it opens the application and when clicking the button to run the method the following error appears: My Application2 has stopped.

inserir a descrição da imagem aqui

  • 1

    Have you looked in the logcat??

  • No.. I did it a different way now and it looks like it’s working cool. I took this my way and put the code inside the Ackground, and I give run by the instance of the class that inherits from the Async Task, until now it is working legal .

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.