I'm trying to start an Activity (StartGame) from inside of a SurfaceView once I touch in a certain spot. This code is inside the OnTouchEvent
It won't accept what I have below, of course, but I don't know what to put in the Context space.
I've tried my package (com.Juggle2.Menu), but that doesn't work, because it can't resolve it to a variable, and "this" doesn't work because it's a class. I don't know what else to try.
startActivity(new Intent(com.Juggle2.Menu, StartGame.class));
This does not work because "com.Juggle2.Menu cannot be resolved to a variable"
My Manifest is as follows
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".Juggle2"
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=".Menu"
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=".StartGame">
</activity>
<activity android:name = ".Help">
</activity>
<activity android:name = ".Options">
</activity>
<activity android:name = ".Credits">
</activity>
</application>
And my project goes com.Juggle2>Menu.java
Try startActivity(new Intent(com.Juggle2.Menu.this, StartGame.class));
Edit working:
Context context = com.Juggle2.Menu.this.getContext();
context.startActivity(new Intent(context, StartGame.class));
Related
I made my schedule. I'm installing but the apk is not there. everything is clear in the picture
I made changes to the manifest, is it something related to it?
Manifest
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<category android:name="android.intent.category.LAUNCHER" />
</activity></intent-filter>
</activity>
<activity
android:name=".guzelsozleractivity"
android:label="#string/app_name" />
</application>
You are declaring MainActivity twice.
Declare it like this:
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Your manifest was wrongly entered, update the Manifest.xml to the code given below it will work. Please like and accept the answer if it worked.
Happy coding.
<activity
android:name=".MainActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
I have an existing Android Studio project and i wanted to remove splash screen. I tried to remove changes in AndroidManifest.xml but couldn't make it.
Here this my actual AndroidManifest.xml
<!-- Home Tab Group -->
<activity
android:name=".view.TabHomeActivity"
android:label="#string/app_name"
android:windowSoftInputMode="adjustPan|stateHidden" >
</activity>
<activity
android:name=".view.activity.SplashActivity"
android:label="#string/app_name"
android:windowSoftInputMode="adjustPan|stateHidden" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".view.activity.TestLoginFacebookActivity"
android:configChanges="keyboardHidden|orientation"
>
</activity>
<!-- Tab Screen -->
<activity android:name=".view.tabscreen.TabHomeScreen"
android:windowSoftInputMode="stateAlwaysHidden|adjustResize" />
Delete the SplashActivity class,delete it from the manifest. Set the Launching Activity first which you want to come as your first screen
<activity
android:name=".view.TabHomeActivity"
android:label="#string/app_name"
android:windowSoftInputMode="adjustPan|stateHidden" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".view.activity.TestLoginFacebookActivity"
android:configChanges="keyboardHidden|orientation"
>
</activity>
Delete the SplashActivity class,
delete it's layout,
delete it from the manifest.
Add the intent filters to your TabHomeActivity.
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
When I am trying to debug-run my application I am getting this error in console:
Default Activity not foundWaiting for process: com.myapp.myapp
My AndroidManifest look like this:
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<activity
android:name="com.myapp.myapp.Splash"
android:label="#string/app_name"
android:noHistory="true">
<intent-filter>
<action android:name="android.intent.action.Main" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.myapp.myapp.Main"
android:label="#string/app_name"
android:launchMode="singleInstance"
android:windowSoftInputMode="adjustPan">
<intent-filter>
<action android:name="android.intent.action.Main" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
This doesn't work for me because I can't find any sources tab as mentioned there.
For the second activity, in intent filter, change android:name to com.myapp.myapp.Main .
I can't find any problem but it keep giving me the error "No Launcher activity found!" and "The launch will only sync the application package on the device!"
can anyone solve this problem???
This is my Maniest
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.saikoro.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.example.saikoro.StartUp"
android:label="#string/app_name" >
<intent-filter>
<action android:name="com.example.saikoro.StartUp" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
The <activity> element of the activity you want to launch through the icon on the app list must contain both of the following parts of the intent-filter:
<intent-filter>
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.MAIN" />
</intent-filter>
Your current manifest has an activity with category LAUNCHER and action MAIN, but in different activities. The one with the icon in the app list must have them both.
Change
<action android:name="com.example.saikoro.StartUp" />
with
<action android:name="android.intent.action.MAIN" />
I am making a simple Android Application, which consists of only two activities, .Password and .Adder
<activity
android:name=".Adder"
android:label="#string/title_activity_adder" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".Password"
android:label="#string/title_activity_adder" >
<intent-filter>
<action android:name="android.intent.action.PASSWORD" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
The .Password activity is set as the LAUNCHER but when I run it, the .Adder Activity shows us instead.
I have the .xml and .java file for both the activity properly connected by setContentView() and Eclipse is not reporting any kind of error in any file at all.
The Password Activity checks for the correct password and switches control to the Adder Activity:
Intent openStartingPoint = new Intent("com.example.pointsadder.MAIN");
startActivity(openStartingPoint);
You don t have to write intent filter to each activity. Correct xml:
<activity
android:name=".Adder"
android:label="#string/title_activity_adder" >
</activity>
<activity
android:name=".Password"
android:label="#string/title_activity_adder" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Change this:
<activity
android:name=".Password"
android:label="#string/title_activity_adder" >
<intent-filter>
<action android:name="android.intent.action.PASSWORD" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
to this:
<activity
android:name=".Password"
android:label="#string/title_activity_adder" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
And modify this as shown:
<activity
android:name=".Adder"
android:label="#string/title_activity_adder" >
</activity>
Refer to this link: http://developer.android.com/guide/topics/manifest/manifest-intro.html#iconlabel for more details.