I had a libgdx program which starts with the following class:
public class MyActivity extends AndroidApplication implements IActivityRequestHandler
I needed to have an Activity
class to detect screen size using Display
(I can't do that in an AndroidApplication
class).
So I added the following class as my launcher Activity
:
public class MyActivity1 extends Activity
So in my new class MyActivity1
I try to run my old class MyActivity
:
Intent myIntent = new Intent(MyActivity.this, MyActivity.class);
startActivity(myIntent);
But I got the following compilation error: MyActivity is not an enclosing class
Manifest is as follows
<activity android:name=".MyActivity1"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name=".MyActivity"/>
Why am I getting this error?
Try with this
The new Intent requires the current activity's context (first param) and the class which you want initializate (second param).