How to fix android.os.NetworkOnMainThreadException Error by creating new Thread in Android Code?

preview_player
Показать описание


Complete source code and other details/ steps of this video are posted in the below link:

However, the main Java code is copied below also for reference:

public class MainActivity extends AppCompatActivity {

private ImageView imageView;
private TextView textView;

private URL url;
private Bitmap bitmap;

@Override
protected void onCreate(Bundle savedInstanceState) {

try {
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}

public void buttonError(View view){
try {
} catch (Exception e) {
}
}
public void buttonResolution(View view){
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
try {
} catch (Exception e) {
}
}
});
}
}
}

--
Рекомендации по теме
welcome to shbcf.ru