Here's the error, referring to where I call startActivity(Intent):
`05-17 01:40:37.918: E/AndroidRuntime(12997):android.content.ActivityNotFoundException:
Unable to find explicit activity class {/com.rhombi.Menu}; have you declared
this activity in your AndroidManifest.xml?
Here's how I use startActivity(Intent) in com.rhombi.Intro:
startActivity(iMenu);
Here's how I declare it earlier, in the same class:
public Intent iMenu = new Intent(this, Menu.class);
Here's how I declare it all in my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.rhombi"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen" >
<activity
android:name=".Intro"
android:label="#string/app_name"
android:screenOrientation="portrait" >
<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"
android:screenOrientation="portrait" >
</activity>
</application>
</manifest>
I've searched through a TON of other questions about this and I can't seem to figure out what the issue is. The one thing that makes my issue unique is that little forward slash when it tells me that it's unable to find the explicit activity class ("{/com.rhombi.Menu}"). That never showed up in my searches, but I appear to be doing everything right.
There was something wrong with the this you passed as a Context to the Intent constructor, as evidenced by the empty package name in ComponentInfo {/com.rhombi.Menu} - there's just the class name.
try changing
android:name=".Menu" to android:name="{package name}.Menu"
Related
I am trying to have a different app name for an Activity "My Profile Photo" but it does not seem to show up even when I have given android:label="My Profile Pic" to that particular activity
The Manifest File:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.aditya.myprofile">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity"
android:label="My Profile">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".ProfilePhoto"
android:label="Profile Pic" ></activity>
</application>
</manifest>
The XML Design:
The Android App name space is empty
Where am I going wrong?
Try this add title through java code add this code in your activity like this
getSupportActionBar().setTitle("My Profile");
I think you need to set a theme to your activity in your manifest.
<activity android:name=".ProfilePhoto"
android:theme="#style/AppTheme"
android:label="#string/profilePicture></activity>
Another solution : in your activity in onCreate you need to call :
getSupportActionBar().setTitle("Your Activity Title");
I face a problem in android application. When I call Intent with a button the window disappear. Here is my code:
public void btn_open_click(View view) {
Intent i = new Intent(MainActivity.this, Add_User.class);
startActivity(i);
}
and here is Manifest File:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.antiatlasdev.myapplication">
<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">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="Add_User"
android:label="#string/app_name">
</activity>
</application>
</manifest>
Any idea? Thanks in advance.
<activity
android:name="com.example.antiatlasdev.myapplication.Add_User"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar"</activity>
use this
This is because you don't use the correct class name for the activity. You're using inccorrect class name:
<activity android:name="Add_User"
android:label="#string/app_name">
</ activity>
It should be using .Add_User instead of Add_User. You need to add the . to tell that your activity name is relative to your package name. Or you can also using the complete package name and the class activity name. Something like this:
<activity android:name="com.yourpackagename.Add_User"
android:label="#string/app_name">
</activity>
The name attribute
should be a fully qualified class name (such as, "com.example.project.ExtracurricularActivity"). However, as a shorthand, if the first character of the name is a period (for example, ".ExtracurricularActivity"), it is appended to the package name specified in the element.
So, if the Add_User class in in the com.example.antiatlasdev.myapplication package you can code as:
<activity
android:name=".Add_User"
android:label="#string/app_name">
</activity>
while if Add_User is in another package, for example in the com.example.antiatlasdev.anotherPackage package, then you will have to specify it like:
<activity
android:name="com.example.antiatlasdev.anotherPackage.Add_User"
android:label="#string/app_name">
</activity>
okay, this is my very first application which i am working on, everything works fine until i wanted to add a settings button to my live wallpaper, the problem is, when i simply hit "settings" it comes with this message of "live wallpaper picker has stopped". here's my code
Android manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.Live.zaki"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="16" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.ui.MainActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:exported="true"
android:label="#string/app_name"
android:theme="#style/FullscreenTheme" >
/>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
android:label="#string/appName"
android:icon="#drawable/icon">
<service
android:name="com.Live.zaki.CustomWallpaper"
android:label="#string/appName"
android:permission="android.permission.BIND_WALLPAPER" >
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
</intent-filter>
<meta-data
android:name="android.service.wallpaper"
android:resource="#xml/wallpaper" />
</service>
<activity
android:name="com.example.ui.SecondActivity"
android:label="Home" >
</activity>
<activity
android:name=".PrefsActivity"
android:theme="#android:style/Theme.Black.NoTitleBar" >
</activity>
</application>
</manifest>
wallpaper.xml
<wallpaper xmlns:android="http://schemas.android.com/apk/res/android"
android:thumbnail="#drawable/icon"
android:description="#string/appDescription"
android:settingsActivity="com.Live.zaki.PrefsActivity"
/>
prefs.xml
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory
android:title="#string/general_lwp_settings">
<CheckBoxPreference
android:key="lwp_o_scroll_lock_key"
android:summary="#string/lwp_o_scroll_lock_summary"
android:title="#string/lwp_o_scroll_lock_title"
android:defaultValue="false" />
<CheckBoxPreference
android:key="lwp_auto_animation_key"
android:summary="#string/lwp_auto_animation_summary"
android:title="#string/lwp_auto_animation_title"
android:defaultValue="false" />
</PreferenceCategory>
PrefsActivity.java
public class PrefsActivity extends PreferenceActivity{#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(com.Live.zaki.R.xml.prefs);
}
}
i haven't yet configured any preference logic on my main livewallpaper.java code, i just want that settings menu to popup "two checkbox in my case". Is this even possible ??
if anyone could help me, that would great !! tips, tutorials anything !!
here's my application results without settings,
https://drive.google.com/file/d/0B44QwXQHh5irNFRnYkhzdDhPM00/edit?usp=sharing
buddy add exported flag in setting activity and set it true android:exported="true"
change the package name in your xml folder wallpaper.xml file to a fully qualified name.
android:settingsActivity="yourPackagename.PrefsActivity"
in the Manifest file add:
<activity
android:exported="true"
android:name=".PrefsActivity"
android:theme="#android:style/Theme.Black.NoTitleBar">
I am currently using android studio and I have put in my activities in the manifest file and I believe I am calling it correctly. I keep getting this error though:
Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {/com.ca.android.easycall.customers1}; have you declared this activity in your AndroidManifest.xml?
This is my Call:
Intent actCustomers1 = new Intent(this, customers1.class);
startActivity(actCustomers1);
Here is my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ca.android.easycall"
android:versionCode="1"
android:versionName="1.0" >
<permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.ca.android.easycall.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=".customers1"
android:label="#string/title_activity_customers1" >
</activity>
<activity
android:name=".customers2"
android:label="#string/title_activity_customers2" >
</activity>
</application>
</manifest>
From what you posted, it looks like your class customers1 is not declared in package com.ca.android.easycall
When you have something like android:name=".customers1", Android compiler will try to prepend it with package name package="com.ca.android.easycall", so it becomes com.ca.android.easycall.customers1
Quoted from Android official documentation:
android:name
The name of the class that implements the activity, a
subclass of Activity. The attribute value should be a fully qualified
class name (such as, "com.example.project.ExtracurricularActivity").
However, as a shorthand, if the first character of the name is a
period (for example, ".ExtracurricularActivity"), it is appended to
the package name specified in the element.
However because you got the error log:
Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {/com.ca.android.easycall.customers1}; have you declared this activity in your AndroidManifest.xml?
So it must be either customers1 is not declared or customers1 is not in com.ca.android.easycall package
Try this one,
<activity
android:name="com.ca.android.easycall.customers1"
android:label="#string/title_activity_customers1" >
</activity>
<activity
android:name="com.ca.android.easycall.customers2"
android:label="#string/title_activity_customers2" >
</activity>
Please edit your Manifest.xml like this:
<activity
android:name="com.ca.android.easycall.customers1"
android:label="#string/title_activity_customers1" >
</activity>
<activity
android:name="com.ca.android.easycall.customers2"
android:label="#string/title_activity_customers2" >
</activity>
I hope this helps.
Check the package at the top of the activity file. Maybe the activities have a different package than your application.
If it is different change it to the one you have in your manifest com.ca.android.easycall
I'm very new to Android programming and I've been trying to figure out why my app is force-closing on a button-click. I've narrowed it down to a few things.
One question; Is it possible to have more than one <application> tag in the manifest xml?
Here is my code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dummies.android.beergoggles"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
<application android:icon="#drawable/icon" android:label="#string/app_name">
<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="Result" android:label="#string/app_name"> </activity>
</application>
<application android:name="MyApp"
android:icon="#drawable/icon"
android:label="#string/app_name2"></application>
I've been researching, but found only a vague post about creating a new manifest file for a new application. The MyApp application is just an app for a "global variable", since I guess there's no way to do that without a new application.
Here is the code for MyApp in case it helps:
import android.app.Application;
public class MyApp extends Application{
public static int resultCount;
public int getCount(){
return resultCount;
}
public void setCount(int c){
resultCount = c;
}
}
Any help would be much appreciated.
According to documentation manifest file with only one application element is valid.
Only the <manifest> and <application> elements are required, they each
must be present and can occur only once.
What I think you want is to use your custom Application as the main Application.
So you dont add a new <application> but just specify its name to the main <application>(you need to specify its full package).
<application android:icon="#drawable/icon" android:label="#string/app_name" android:name:"com.mypackage.MyApp"> <!-- Added the android:name -->
<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="Result" android:label="#string/app_name"> </activity>
</application>
See info here
Only the 'manifest' and 'application' elements are required, they each must be present and can occur only once. Most of the others can occur many times or not at all — although at least some of them must be present for the manifest to accomplish anything meaningful.