You need to use fully qualified class name, not the leading dot shorthand
notation.

Also, this may not be part of the SDK (check), and as such may not work on
all phones.

Wrap your code in a try catch block, and handle ActivityNotFoundException.

--
Kostya Vasilyev -- http://kmansoft.wordpress.com

15.11.2010 1:17 пользователь "Diego Queiroz" <[email protected]> написал:

Hi there!

I'm having some trouble linking my app to another.
What i want to do is call the battery use app from android settings.
So i have to know the action and the component called to start this app, ok?
Here's my code:

ComponentName cn = new ComponentName("com.android.settings",
".fuelgauge.PowerUsageSummary");

Intent i = new Intent("android.intent.action.MAIN");

i.setComponent(cn);

startActivity(i);


and the error:


11-14 19:06:50.136: ERROR/AndroidRuntime(361): Uncaught handler: thread main
exiting due to uncaught exception

11-14 19:06:50.166: ERROR/AndroidRuntime(361):
android.content.ActivityNotFoundException: Unable to find explicit activity
class {com.android.settings/.fuelgauge.PowerUsageSummary}; have you declared
this activity in your AndroidManifest.xml?

11-14 19:06:50.166: ERROR/AndroidRuntime(361):     at
android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1404)

11-14 19:06:50.166: ERROR/AndroidRuntime(361):     at
android.app.Instrumentation.execStartActivity(Instrumentation.java:1378)

11-14 19:06:50.166: ERROR/AndroidRuntime(361):     at
android.app.Activity.startActivityForResult(Activity.java:2749)

11-14 19:06:50.166: ERROR/AndroidRuntime(361):     at
android.app.Activity.startActivity(Activity.java:2855)

11-14 19:06:50.166: ERROR/AndroidRuntime(361):     at
com.noapparatus.ramuh.Play$5.onClick(Play.java:192)

11-14 19:06:50.166: ERROR/AndroidRuntime(361):     at
android.view.View.performClick(View.java:2364)

11-14 19:06:50.166: ERROR/AndroidRuntime(361):     at
android.view.View.onTouchEvent(View.java:4179)

11-14 19:06:50.166: ERROR/AndroidRuntime(361):     at
android.widget.TextView.onTouchEvent(TextView.java:6540)

11-14 19:06:50.166: ERROR/AndroidRuntime(361):     at
android.view.View.dispatchTouchEvent(View.java:3709)

11-14 19:06:50.166: ERROR/AndroidRuntime(361):     at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)

11-14 19:06:50.166: ERROR/AndroidRuntime(361):     at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)

11-14 19:06:50.166: ERROR/AndroidRuntime(361):     at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)

11-14 19:06:50.166: ERROR/AndroidRuntime(361):     at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)

11-14 19:06:50.166: ERROR/AndroidRuntime(361):     at
com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1659)

11-14 19:06:50.166: ERROR/AndroidRuntime(361):     at
com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107)

11-14 19:06:50.166: ERROR/AndroidRuntime(361):     at
android.app.Activity.dispatchTouchEvent(Activity.java:2061)

11-14 19:06:50.166: ERROR/AndroidRuntime(361):     at
com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1643)

11-14 19:06:50.166: ERROR/AndroidRuntime(361):     at
android.view.ViewRoot.handleMessage(ViewRoot.java:1691)

11-14 19:06:50.166: ERROR/AndroidRuntime(361):     at
android.os.Handler.dispatchMessage(Handler.java:99)

11-14 19:06:50.166: ERROR/AndroidRuntime(361):     at
android.os.Looper.loop(Looper.java:123)

11-14 19:06:50.166: ERROR/AndroidRuntime(361):     at
android.app.ActivityThread.main(ActivityThread.java:4363)

11-14 19:06:50.166: ERROR/AndroidRuntime(361):     at
java.lang.reflect.Method.invokeNative(Native Method)

11-14 19:06:50.166: ERROR/AndroidRuntime(361):     at
java.lang.reflect.Method.invoke(Method.java:521)

11-14 19:06:50.166: ERROR/AndroidRuntime(361):     at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)

11-14 19:06:50.166: ERROR/AndroidRuntime(361):     at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)

11-14 19:06:50.166: ERROR/AndroidRuntime(361):     at
dalvik.system.NativeStart.main(Native Method)


Do i need to do some declaration on the manifest file?

Ty in advance =)


-- 
*Diego Queiroz*

-- 
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]<android-developers%[email protected]>
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

-- 
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

Reply via email to