The error was caused by the HelloWorld app's manifest not having the
correct default linkage:
Here's the calling app followed by the corrected helloworld manifest.
There had to be
<intent-filter>
<action android:name="com.thomas.needham.HELLOWORLD" /
>
<category
android:name="android.intent.category.DEFAULT" />
</intent-filter>
as well as .LAUNCHER
____________________________________________________________________
package com.needham.NLauncher;
import android.app.Activity;
import android.app.KeyguardManager;
import android.app.KeyguardManager.KeyguardLock;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Window;
import android.view.WindowManager;
public class SubLauncher extends Activity {
/** Called when the activity is first created. */
private static final String TAG = "NSubLauncher1";
public void onCreate(Bundle ThomasofNeedham) {
super.onCreate(ThomasofNeedham);
try {
KeyguardManager mKeyGuardManager = (KeyguardManager)
getSystemService(KEYGUARD_SERVICE);
KeyguardLock mLock =
mKeyGuardManager.newKeyguardLock("SubLauncher");
mLock.disableKeyguard();
Intent openStartingPoint = new
Intent("com.thomas.needham.HELLOWORLD");
Log.d(TAG, "IntentopenStartingPoint: "+ openStartingPoint );
startActivity(openStartingPoint);
} catch (ActivityNotFoundException e) {
e.printStackTrace();
}
}
}
----------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.thomas.needham"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="7" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".HelloWorld"
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=".HelloWorld"
android:label="@string/app_name" >
<intent-filter>
<action android:name="com.thomas.needham.HELLOWORLD" /
>
<category
android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
_____________________________________________________________________________________
On Feb 27, 10:00 pm, Thomas <[email protected]> wrote:
> Changed things around and now have a new error "*******************
> Error ********************************
> W/System.err( 621): android.content.ActivityNotFoundException: Unable
> to find explicit activity class {com.thomas.needham/.HelloWorld}; have
> you declared this activity in your AndroidManifest.xml?"
>
> It is unclear which manifest the error is referencing as the log seems
> to indicate "Displayed activity com.thomas.needham/.HelloWorld" for
> intent code and the HelloWorld code.
>
> Here's some revised code
> ------------ Hello World ------------------------------------------
> package com.thomas.needham;
>
> import android.app.Activity;
> import android.os.Bundle;
> import android.widget.TextView;
>
> public class HelloWorld extends Activity {
> /** Called when the activity is first created. */
> @Override
> public void onCreate(Bundle savedInstanceState) {
> super.onCreate(savedInstanceState);
> TextView tv = new TextView(this);
> tv.setText("Hello, Android Once More!!");
> setContentView(tv);
>
> }}
>
> ----------------------Hello World Manifest
> ------------------------------------
> <?xml version="1.0" encoding="utf-8"?>
> <manifest xmlns:android="http://schemas.android.com/apk/res/android"
> package="com.thomas.needham"
> android:versionCode="1"
> android:versionName="1.0" >
>
> <uses-sdk android:minSdkVersion="7" />
>
> <application
> android:icon="@drawable/ic_launcher"
> android:label="@string/app_name" >
> <activity
> android:name=".HelloWorld"
> android:label="@string/app_name" >
> <intent-filter>
> <action
> android:name="com.thomas.needham.HelloWorld" />
> </intent-filter>
> <intent-filter>
> <action android:name="android.intent.action.MAIN" />
> <category
> android:name="android.intent.category.LAUNCHER" />
> </intent-filter>
> </activity>
> </application>
>
> </manifest>
>
> ------------- Revised Intent Program -----------------------------
> package com.needham.NLauncher;
>
> import android.app.Activity;
> import android.content.ActivityNotFoundException;
>
> import android.content.Intent;
> import android.os.Bundle;
> import android.util.Log;
>
> public class SubLauncher extends Activity {
> /** Called when the activity is first created. */
> private static final String TAG = "NSubLauncher1";
>
> public void onCreate(Bundle savedInstanceState) {
>
> Intent helloworldIntent = new Intent();
> helloworldIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
> helloworldIntent.setClassName("com.thomas.needham",
> ".HelloWorld");
> try {
> Log.d(TAG, "HelloworldIntent: "+ helloworldIntent );
> startActivity(helloworldIntent);
>
> } catch (ActivityNotFoundException e) {
> e.printStackTrace();
> }
>
> ------------------------- NLauncher manifest
>
> <?xml version="1.0" encoding="utf-8"?>
> <manifest xmlns:android="http://schemas.android.com/apk/res/android"
> package="com.needham.NLauncher"
> android:versionCode="1"
> android:versionName="1.0" >
>
> <uses-sdk android:minSdkVersion="7" />
> <uses-permission
> android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
>
> <application
> android:icon="@drawable/ic_launcher"
> android:label="@string/app_name" android:debuggable="true">
> <activity
> android:name=".SubLauncher"
> android:label="@string/app_name" >
>
> <intent-filter>
> <action android:name="android.intent.action.MAIN" />
>
> <category android:name="android.intent.category.LAUNCHER" />
>
> </intent-filter>
> </activity>
>
> <!-- android.intent.action.BOOT_COMPLETED -->
> <receiver android:name="com.needham.NLauncher.NLauncher" >
>
> <intent-filter>
> <action android:name="android.intent.action.BOOT_COMPLETED" />
> </intent-filter>
>
> <intent-filter>
> <action android:name=".HelloWorld.LAUNCH_APP" />
> <!-- <action android:name="com.needham.NLauncher.LAUNCH_APP" /> -->
> </intent-filter>
> </receiver>
>
> </application>
> </manifest>
>
> ------------------------------Logcat --------------------------------
> D/dalvikvm( 97): GC freed 123 objects / 5072 bytes in 80ms
>
> ********************* HelloWord starts ********************
>
> I/ActivityManager( 51): Starting activity: Intent
> { act=android.intent.action.MAIN
> cat=[android.intent.category.LAUNCHER] flg=0x10200000
> cmp=com.thomas.needham/.HelloWorld }
>
> I/ActivityManager( 51): Displayed activity
> com.thomas.needham/.HelloWorld: 488 ms (total 3909291 ms)
>
> W/KeyCharacterMap( 501): No keyboard for id 0
>
> W/KeyCharacterMap( 501): Using default keymap: /system/usr/keychars/
> qwerty.kcm.bin
>
> W/KeyCharacterMap( 97): No keyboard for id 0
>
> W/KeyCharacterMap( 97): Using default keymap: /system/usr/keychars/
> qwerty.kcm.bin
>
> D/dalvikvm( 501): GC freed 281 objects / 16824 bytes in 154ms
> *************** NLauncher starts ****************************
> I/ActivityManager( 51): Starting activity: Intent
> { act=android.intent.action.MAIN
> cat=[android.intent.category.LAUNCHER] flg=0x10200000
> cmp=com.needham.NLauncher/.SubLauncher }
>
> I/ActivityManager( 51): Start proc com.needham.NLauncher for
> activity com.needham.NLauncher/.SubLauncher: pid=621 uid=10035 gids={}
>
> D/ddm-heap( 621): Got feature list request
>
> D/NSubLauncher1( 621): HelloworldIntent: Intent { flg=0x10000000
> cmp=com.thomas.needham/.HelloWorld }
>
> I/ActivityManager( 51): Starting activity: Intent { flg=0x10000000
> cmp=com.thomas.needham/.HelloWorld }
> ******************* Error ********************************
> W/System.err( 621): android.content.ActivityNotFoundException: Unable
> to find explicit activity class {com.thomas.needham/.HelloWorld}; have
> you declared this activity in your AndroidManifest.xml?
>
> W/System.err( 621): at
> android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:
> 1404)
>
> W/System.err( 621): at
> android.app.Instrumentation.execStartActivity(Instrumentation.java:
> 1378)
>
> ----------------------------------------------------------------------------
>
> On Feb 27, 1:34 pm, Kostya Vasilyev <[email protected]> wrote:
>
>
>
>
>
>
>
> > The Android runtime is entirely correct.
>
> > This code:
>
> > public class SubLauncher extends Activity {
> > /** Called when the activity is first created. */
> > private static final String TAG = "NSubLauncher1";
>
> > public void onCreate(Bundle savedInstanceState) {
>
> > * Intent helloworldIntent = new Intent ("com.needham.helloworld",
> > null);*
>
> > ... creates the Intent using this constructor:
>
> > > publicIntent(String
> > >
> > > <http://developer.android.com/reference/java/lang/String.html>action,Uri
> > > <http://developer.android.com/reference/android/net/Uri.html>uri)
>
> > > Since:API Level 1
> > > <http://developer.android.com/guide/appendix/api-levels.html#level1>
>
> > > Create an intent with a given action and for a given data url. Note
> > > that the action/must/be in a namespace because Intents are used
> > > globally in the system -- for example the system VIEW action is
> > > android.intent.action.VIEW; an application's custom action would be
> > > something like com.google.app.myapp.CUSTOM_ACTION.
>
> > The hello world manifest does not specify an intent filter with action =
> > "com.needham.helloworld", thus the error.
>
> > I believe you probably meant to create your intent with explicit package
> > and class names. To do that, create an empty intent first, then call
> > setClassName(String packageName, String className).
>
> > It might find it useful to spend some time reading the docs on Intent
> > and intent matching.
>
> > -- Kostya
>
> > On 02/27/2012 10:19 PM, Thomas wrote:
>
> > > I need to have an bootup app call another app and while the bootup app
> > > appears to work, the second app cannot be found? The NLauncher was
> > > derived from another thread "start at boot app gives
> > > instantiationException:" in which it took a lot conversation to
> > > resolve and I thank all concerned.
> > > I added some debug statements to help isolate the problem.
> > > Thanks in advance to all.
> > > Tom B
>
> > > Error:
> > > Intent { act=com.needham.helloworld }W/System.err( 191):
> > > android.content.ActivityNotFoundException: No Activity found to handle
> > > Intent { act=com.needham.helloworld }W/System.err( 191):
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en