Exception networkonmainthreadexception in Android

Posted by Unknown Selasa, 24 Juli 2012 0 komentar

Exception networkonmainthreadexception in Android



This exception is due to the StrictMode introduced on honeycomb or later android devices to not allow the network operations in main thread.


The solution to this exception is that you implement a thread for network operation instead of implementing in main thread.


The alternative method is to disable the option which is enable by default in honeycomb and later android OS.The previous versions of android OS allowed the main thread to create the network connections.


Disabling the StrictMode in Android


StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);


If you like the solution please provide your comments.


Thanks
Creative Android Apps
TERIMA KASIH ATAS KUNJUNGAN SAUDARA
Judul: Exception networkonmainthreadexception in Android
Ditulis oleh Unknown
Rating Blog 5 dari 5
Semoga artikel ini bermanfaat bagi saudara. Jika ingin mengutip, baik itu sebagian atau keseluruhan dari isi artikel ini harap menyertakan link dofollow ke https://apk-xda.blogspot.com/2012/07/exception-networkonmainthreadexception.html. Terima kasih sudah singgah membaca artikel ini.

0 komentar:

Posting Komentar

Trik SEO Terbaru support Online Shop Baju Wanita - Original design by Bamz | Copyright of apk xda.