Why is my app is crashing while using async task?

You are Calling Activity in a Background Thread Thats Why you are getting Error You Need to Call Like this Thread thread=new Thread(){ @Override public void run() { try { sleep(5*1000); runOnUiThread(new Runnable() { @Override public void run() { Intent i = new Intent(getApplicationContext(),MainActivity2.class); startActivity(i); } }); } catch (Exception ex) {} } }; thread.start();

app has stopped (runtime error) onclick

Where do you initialize currentIndex? You’re using currentIndex++; but you never initialize it unless it is your position. And you’re using return inside an if when you’re using a void from onClick. If you want to do something like this try something like this: And change first parameter of Toast to v.getContext() public void onClick(View … Read more

Android Studio / kotlin

Android studio version 2.x requirements for windows OS version : Windows 7 or later RAM : 3 GB RAM minimum, 8 GB RAM recommended; plus 1 GB for the Android Emulator Disk space : 500 MB disk space for Android Studio, at least 1.5 GB for Android SDK, emulator system images, and caches Java version … Read more