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