Announcement Announcement Module
Collapse
No announcement yet.
error while testting on my device Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • error while testting on my device

    hi
    all my web service are ok when i test on the emulator but when deploy my application on a device i have this error
    Code:
    04-23 17:32:51.769: E/AndroidRuntime(7797): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.soutem.service/com.soutem.activity.rest}: android.os.NetworkOnMainThreadException
    04-23 17:32:51.769: E/AndroidRuntime(7797): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
    ......
    
    .......
    04-23 17:32:51.769: E/AndroidRuntime(7797): Caused by: android.os.NetworkOnMainThreadException
    .......
    
    
    04-23 17:32:51.769: E/AndroidRuntime(7797): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
    ..
    i just added the internet permession and i am working on my local network , my device is conected via wifi and my server is jboss 6 ..
    my application android 2.3.3 and my HTC is on android 4 !

  • #2
    i think that i have to integrate something like the AsyncAtivity on the spring android showcase because it seem that Google has puted in place a system that lets us know that this is a bad idea and we can resolve this issue by executing our request in a separate thread or an asyncTask.

    Comment


    • #3
      Yes, Ice Cream Sandwich (Android 4.0) and newer will not allow network requests on the main UI thread. You must use the AsyncTask, as you discovered. There is a method to disable this, however it is not recommended.

      Comment


      • #4
        ya i see it ; all async tasck are done but , i am working with XML data , it seem that it is too slow, maby it is caused by the large quantities of data that i am retrieving ,

        Comment


        • #5
          Originally posted by Roy Clarkson View Post
          Yes, Ice Cream Sandwich (Android 4.0) and newer will not allow network requests on the main UI thread. You must use the AsyncTask, as you discovered. There is a method to disable this, however it is not recommended.
          Ice Cream Sandwich? When was this released?

          Comment


          • #6
            Android 4.0 was released last year.

            Android 4.1, Jelly Bean, was announced in June, 2012, at the Google I/O conference, and the SDK was recently released.

            Comment

            Working...
            X