running an app and it crash - android

hi when i click on launch my app, the first page comes up, when i want to navigate to my next page the app stop works and give me this error:
Process: com.example.arel0002.pizzeria, PID: 4215
android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.arel0002.pizzeria/com.example.arel0002.pizzeria.pizza}; have you declared this activity in your AndroidManifest.xml?

Did you read this:
have you declared this activity in your AndroidManifest.xml?
You need to declare your Activity in AndroidManifest.xml
In your Manifest declare like this
<activity android:name=".YourActivityName" android:screenOrientation="portrait" />
Here .YourActivityName is your Activity name

Define Your Activity in Manifest to which you want to go
Like this
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".mainpage"
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="com.example.arel0002.pizzeria.pizza"
>
</activity>
<activity
android:name="com.example.arel0002.pizzeria.erbjudanden"
>
</activity>
<activity
android:name="com.example.arel0002.pizzeria.omoss"
>
</activity>
</application>

*Declare your activity in (AndroidManifest.xml)

<?xml version="1.0" encoding="utf-8"?>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".mainpage"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

Related

XML/Android :screenOrientation only works at MainActivity?

So I put screenOrientation="nosensor" (also tried portrait, as I want every activity only to be able to be vertically) in manifest file, but it only works in MainActivity, but when I change to another activity, it can rotate the page again, why is this happening, and what should I do?
This is my manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.frisbeecaddy">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".ActivityNewGame2"></activity>
<activity android:name=".ActivityResume" />
<activity android:name=".ActivityNewGame" />
<activity android:name=".ActivityNewCourse" />
<activity android:name=".ActivityCourses" />
<activity android:name=".ActivityPlayers" />
<activity
android:name=".MainActivity"
android:screenOrientation="nosensor">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Put this line in all of your activities.
android:screenOrientation="nosensor"
for example in your code:-
<activity android:name=".ActivityNewGame2"
android:screenOrientation="nosensor"/>
<activity android:name=".ActivityResume"
android:screenOrientation="nosensor" />
<activity android:name=".ActivityNewGame"
android:screenOrientation="nosensor"/>
<activity android:name=".ActivityNewCourse"
android:screenOrientation="nosensor"/>
<activity android:name=".ActivityCourses"
android:screenOrientation="nosensor"/>
<activity android:name=".ActivityPlayers"
android:screenOrientation="nosensor"/>
You have to specify the orientation for every activity.
android:screenOrientation="nosensor"

Why I am getting error with my activity in android?

I declare both of my activity class in AndroidManifest.xml file them when I run my application it stop unfortunately with this error message:-
android.content.ActivityNotFoundException: Unable to find explicit activity class {com.androidtutorialpoint.androidobservablescrollview/com.androidtutorialpoint.androidobservablescrollview.ParallaxToolbarScrollViewActivity}; have you declared this activity in your AndroidManifest.xml?
This is my manifest file:-
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="in.doctormobileapps.androidobservablescrollview">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<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>
<activity
android:name=".ParallaxToolbarScrollViewActivity"
android:label="#string/title_activity_parallaxtoolbarscrollview"
android:theme="#style/AppTheme.Toolbar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="com.androidtutorialpoint.androidobservablescrollview" />
</intent-filter>
</activity>
</application>
</manifest>
My Activity class names are:-
MainActivity
ParallaxToolbarScrollViewActivity
Clean your build and rebuild the project. If you are using instance run android studio feature then disable this for avoid this problem
You placed it in the wrong location it should be inside the application tag. All your <activity... /> tags should be placed under the <application.. /> tag.
Hope this helps!
Remove
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="com.androidtutorialpoint.androidobservablescrollview" />
</intent-filter>
otherwise change your package name insted of
com.androidtutorialpoint.androidobservablescrollview
Remove intent-filter tag from your second activity.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="in.doctormobileapps.androidobservablescrollview">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<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>
<activity
android:name=".ParallaxToolbarScrollViewActivity"
android:label="#string/title_activity_parallaxtoolbarscrollview"
android:theme="#style/AppTheme.Toolbar">
</activity>
</application>
</manifest>
Put intent filter to single activity which you want to start first. If launching activity is MainActivity, then remove intent filter from ParallaxToolbarScrollViewActivity. Or recheck the category line **
"com.androidtutorialpoint.androidobservablescrollview"
**
<activity
android:name=".ParallaxToolbarScrollViewActivity"
android:label="#string/title_activity_parallaxtoolbarscrollview"
android:theme="#style/AppTheme.Toolbar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="com.androidtutorialpoint.androidobservablescrollview" />
</intent-filter>
</activity>

Error when trying to open new activity from menu

I'm trying to move to a new activity from a selected option from a menu on my main screen. The code for doing this is
public boolean onOptionsItemSelected(MenuItem item) {
switch(item.getItemId()) {
case R.id.action_settings:
Intent settingsIntent = new Intent(this, SettingsActivity.class);
this.startActivity(settingsIntent);
break;
The activity is set up in my manifest file as below
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.test.test_controller">
<uses-permission android:name="android.permission.BLUETOOTH" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar"
android:screenOrientation="landscape"
android:configChanges="keyboardHidden|orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<activity android:name=".SettingsActivity" />
The app crashes as soon as it hits the startActivity line with error
Unable to find explicit activity class {com.test.test_controller/com.test.test_controller.SettingsActivity}; have you declared this activity in your AndroidManifest.xml?
I've been away from Android for quite a while so I can't understand why is it putting the package name in twice? I've checked my settings and the App Id is the same as the package name in the manifest so what am I doing wrong?
Add this </activity> tag after <intent-filter> so system will consider them two activities.
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar"
android:screenOrientation="landscape"
android:configChanges="keyboardHidden|orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity> // add this tag here
<activity android:name=".SettingsActivity" />
Declare your SettingsActivity in your android manifest:
<activity
android:name=".SettingsActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
Check Manifest file. The <activity> tag for .MainActivity is not closed.
Your Manifest file should be looks like this.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.test.test_controller">
<uses-permission android:name="android.permission.BLUETOOTH" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar"
android:screenOrientation="landscape"
android:configChanges="keyboardHidden|orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>// add this
<activity android:name=".SettingsActivity" />
Hope it helps!!

No Launcher activity found! - Android

I am getting a No Launcher activity found! error while launching my Andoid Application. My AndroidManifest.xml file has a LAUNCHER tag defined. I am not clear why I am getting this error though.
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.test.Menu"
android:label="#string/app_name" >
<intent-filter>
<action android:name="com.example.test.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.test.Class1"
android:label="#string/app_name">
</activity>
<activity
android:name="com.example.test.Class2"
android:label="#string/app_name">
</activity>
</application>
Can anyone advise the cause for this error ?
Replace
<action android:name="com.example.test.MAIN" />
with
<action android:name="android.intent.action.MAIN" />

App Unable to Find Launcher Activity

I have just started to develop a brand new application and I have two Activities set up one which displays the Splash Screen and another the Main one. Here is the manifest file:
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name=".Main"
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=".Splash"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.SPLASH" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
I tried changing android.intent.action also removing the DEFAULT Category line from Main also placing the Splash Activity setup above main.
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name=".Main"
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=".Splash"
android:label="#string/app_name" >
</activity>
</application>
Just realized the .MAIN in action and .LAUNCHER should be in the same activity , it's working now!
check this
Android: No Launcher activity found! was working before

Categories

Resources