Reputation: 3
The app crashes in Android Studio when a button is clicked to reach the another activity through intent
public void next(View view) {
Toast.makeText(getApplicationContext()," Next called " , Toast.LENGTH_SHORT).show();
startActivity(new Intent(getApplicationContext(),SecondActivity.class));
}
The error I am getting from logcat is
Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.utkarsh.internalstorage/com.example.utkarsh.internalstorage.SecondActivity}; have you declared this activity in your AndroidManifest.xml?
Upvotes: 0
Views: 119
Reputation: 1736
specify activity in your android manifest file
<activity android:name="SecondActivity"> </activity>
Upvotes: 1
Reputation: 5731
The issue is, the SecondActivity Activity
wasn't added to the AndroidManifest.xml. Once you add that as an application node, it will work properly.
<activity android:name="com.example.utkarsh.internalstorage.SecondActivity" />
Upvotes: 0