最近我一直在开发一个新应用程序,我正在尝试使用意图添加插件。
我创建了一个名为的小型插件应用程序DLC
,我试图在单击按钮时DLC
从我的主应用程序启动一个活动。MinePedia
为此,我创建了一个调用活动的意图,DLC
但每当我单击按钮时,我都会收到Class not found to handle intent
错误消息。
谁能帮我解决这个问题?
体现在DLC
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dlc"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="10" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter android:label="@string/app_name" android:icon="@drawable/ic_launcher" android:logo="@drawable/ic_launcher">
<action android:name="com.dlc.MainActivity" />
<category android:name="android.intent.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
MainActivity(MinePedia)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button button2 = (Button) findViewById(R.id.button1);
button2.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
startActivity(new Intent(getApplicationContext(), MainActivity2.class));
}
});
Button button9 = (Button) findViewById(R.id.info);
button9.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
startActivity(new Intent(getApplicationContext(), AppInf.class));
}
});
Button button91 = (Button) findViewById(R.id.dlc);
button91.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Intent i=new Intent("com.dlc.MainActivity.class"); startActivity(i);
}
});
Button button96 = (Button) findViewById(R.id.help);
button96.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
startActivity(new Intent(getApplicationContext(), Instruction.class));
}
});
// this
String ns = Context.NOTIFICATION_SERVICE;
NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);
int icon = R.drawable.launcher;
CharSequence tickerText = "MinecraftPedia"; // ticker-text
long when = System.currentTimeMillis();
Context context = getApplicationContext();
CharSequence contentTitle = "MinePedia";
CharSequence contentText = "This is the quick launch button for MinePedia";
Intent notificationIntent = new Intent(this, MainActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
Notification notification = new Notification(icon, tickerText, when);
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
// and this
final int HELLO_ID = 1;
mNotificationManager.notify(HELLO_ID, notification);
}
LOGCAT
08-17 02:39:26.573: E/AndroidRuntime(912): FATAL EXCEPTION: main
08-17 02:39:26.573: E/AndroidRuntime(912): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.dlc.MainActivity.class }
08-17 02:39:26.573: E/AndroidRuntime(912): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1622)
08-17 02:39:26.573: E/AndroidRuntime(912): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1417)
08-17 02:39:26.573: E/AndroidRuntime(912): at android.app.Activity.startActivityForResult(Activity.java:3370)
08-17 02:39:26.573: E/AndroidRuntime(912): at android.app.Activity.startActivityForResult(Activity.java:3331)
08-17 02:39:26.573: E/AndroidRuntime(912): at android.app.Activity.startActivity(Activity.java:3566)
08-17 02:39:26.573: E/AndroidRuntime(912): at android.app.Activity.startActivity(Activity.java:3534)
08-17 02:39:26.573: E/AndroidRuntime(912): at com.shadycorp.minecraftrecipebook.MainActivity$3.onClick(MainActivity.java:59)
08-17 02:39:26.573: E/AndroidRuntime(912): at android.view.View.performClick(View.java:4202)
08-17 02:39:26.573: E/AndroidRuntime(912): at android.view.View$PerformClick.run(View.java:17340)