I have the script to make an URL request to server, like this :
DefaultHttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet(”
try {
HttpResponse response = client.execute(request);
} catch (IOException e) {
e.printStackTrace();
}


but, when i click button ‘Run App’ and installed on my device, it says error on logcat :
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity…android.os.NetworkOnMainThreadException


how to solving?
see this video for details 🙂

Nguồn:https://u-os.org/

Xem Thêm Bài Viết Khác:https://u-os.org/cong-nghe

Author

Write A Comment