How to create an activity class in another activity class?

I want to run an action in my andoird application, so I expanded my own activity class from "Activity", after which I started my activity as follows:

Intent i=new Intent(c,ImageViewer.class); startActivity(i); 

And she also declared her activity in the manifest as follows:

 <activity android:name=".ImageViewer" ></activity> 

but when the program starts, I get below the error:

10-27 14: 40: 06.024: E / AndroidRuntime (230): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.ms. .store / com.ms. .store.PostActivity $ ImageViewer}; Have you announced this activity in your AndroidManifest.xml?

Is my declarative expression incorrect? Could you tell me what the problem is?

+4
source share
1 answer

Instead of "c", specify the keyword "this". And rename the ImageViewer class to IVActivity and make changes to the intent as well as the manifest declaration

  Intent i=new Intent(this, ImageVActivity.class); startActivity(i); 

In manifest file

  <activity android:name=".ImageVActivity" /> 
0
source

Source: https://habr.com/ru/post/1442470/


All Articles