Yap, it works.
Thanks for your help.
On 28 Aug., 11:33, Teo Hong Siang <[EMAIL PROTECTED]> wrote:
> Try specifying the CATEGORY_DEFAULT in your intent filter for the
> second activity.
>
> From android.content.Intent:
> "Activities will very often need to support the CATEGORY_DEFAULT so
> that they can be found by Context.startActivity()."
>
> On Aug 28, 1:13 am, hilti <[EMAIL PROTECTED]> wrote:
>
> > Hi
>
> > I tried to define a private action code and use it in an Activity.
> > But this ended up in an error:
> > AndroidRuntime ... No Activity found to handle Intent
> > { action=custom.action.SECOND_ACTION }
>
> > It would be nice if someone could tell me if I'm doing something
> > wrong.
>
> > Here's the code.
>
> > AndroidManifest.xml:
> > <?xml version="1.0" encoding="utf-8"?>
> > <manifest xmlns:android="http://schemas.android.com/apk/res/android"
> > package="custom.action">
> > <application android:label="CA">
>
> > <activity android:name=".FirstActivity" android:label="First">
> > <intent-filter>
> > <action android:name="android.intent.action.MAIN" />
> > <category
> > android:name="android.intent.category.LAUNCHER" />
> > </intent-filter>
> > </activity>
>
> > <activity android:name=".SecondActivity"
> > android:label="Second">
> > <intent-filter>
> > <action android:name="custom.action.SECOND_ACTION" />
> > <action android:name="android.intent.action.MAIN" />
> > </intent-filter>
> > </activity>
>
> > </application>
> > </manifest>
>
> > FirstActivity.java:
> > public class FirstActivity extends Activity {
>
> > private FirstActivity firstActivity = null;
>
> > @Override
> > public void onCreate(Bundle savedInstanceState) {
> > super.onCreate(savedInstanceState);
> > firstActivity = this;
> > setContentView(R.layout.first);
>
> > Button button = (Button)findViewById(R.id.goto_second);
> > button.setOnClickListener(mGotoListener);
> > }
>
> > private OnClickListener mGotoListener = new OnClickListener() {
> > public void onClick(View v) {
> > //Intent intent = new Intent(firstActivity,
> > SecondActivity.class);
> > Intent intent = new Intent("custom.action.SECOND_ACTION");
> > startActivity(intent);
> > }
> > };
>
> > }
>
> > When I'm explicitly setting the component in the Intent, using
> > SecondActivity.class, it works.
>
> > Thanks a lot.
> > Regards.
--~--~---------~--~----~------------~-------~--~----~
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]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---