This exception is occurs when we call the network calls in Main Thread. 1) Strict mode: 2) AsynkTask
Long Running process never run on Main Thread.
To solve this problem, having following ways
write this code in your onCreate method
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll()
.build();
StrictMode.setThreadPolicy(policy);
write your code inside doInBackground() method
private class DownloadFilesTask extends AsyncTask<Void, Void, Void> {
protected Long doInBackground(URL... urls) {
// write your code here
return ;
}
};
3) Using Thread
Thread thread = new Thread(new Runnable(){
@Override
public void run() {
try {
//Your code goes here
} catch (Exception e) {
e.printStackTrace();
}
}
});
thread.start();
INSTALL_FAILED_INVALID_APK: Split lib_slice_9_apk was defined multiple times. It is possible that th
Symmetric vs Asymmetric Encryption in Android Server - RRutors
Fix Duplicate Files in APK Build.gradle Issue - RRutors
How to get a contact image using a phone number in android?
Emulator: emulator: ERROR: Can't find 'Linux version ' string in kernel image file: Andr
Key Points to remember while develop the Android Application.
ERR_ACCESS_DENIED in Android Webview with sdk 30
How to find Android Device UDID or unique ID?
What is Intent? What is the difference between an implicit intent and an explicit intent?
How to convert milli seconds to hours, minutes and seconds in Android?
How to save activity State in Android?
How to copy database from assets folder in android using kotlin
How to stop EditText focus at Activity startup in Android?
What is the difference between match_parent and fill_parent?
Hide/Disable soft keyboard on Activity launch: Android
What is Context?
How to reduce APK package size?
Fix Play Store Rejection Due to SMS Permission - RRutors
How to Use Deprecated Handler() in Android - RRutors Guide
How to check Android version?
How do I generate random numbers in Dart?
How to Exit android app on back pressed?
How to convert DP to Pixel and Pixel to Dp?
Invoke-customs are only supported starting with android 0 --min-api 26
How To Set Text Color Programmatically Android TextView?
How to install/ uninstall apk by command line ADB
What is Android Fragments?
How to start a new activity on button click
Decompile APK Files: How to Get Source Code - RRutors Guide
Extract Date and Time from Long Type Variable - RRutors
Check List for Generate Signed APK Android
FragmentPagerAdapter deprecated, Since API 27.1.0 FragmentPagerAdapter is deprecated.
What is ANR in android?
What are Android Versions available?
FCM Not Receiving Notifications in Android - RRutors
Fix Behavior Subclass BottomSheetBehavior Exception - RRutors
Open PDF in Google Drive with Intent in Android - RRutors
How do I check in SQLite whether a table exists?
What is "shared preferences" in Android ?
Permission denied for window type 2010 in Marshmallow device