当我打开'NotizBearbeiten.java'(它是一个Activity)时,我得到一个例外。 爪哇:
viewHolderKlasse.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(context, NotizBearbeiten.class);
File file = new File(Environment.getExternalStorageDirectory() + "/Notizen/");
File[] files = file.listFiles();
File absoluteFile = files[files.length - i - 1].getAbsoluteFile();
intent.putExtra("text", absoluteFile);
context.startActivity(intent);
}
});
清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="at.wurz.david.recyclerviewtemplate">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".RecyclerViewActivity"
android:label="@string/app_name">
</activity>
<activity
android:name=".NotizBearbeiten"
android:label="@string/app_name">
</activity>
</application>
</manifest>
错误:
04-09 11:09:52.823 19738-19738/at.wurz.david.recyclerviewtemplate E/AndroidRuntime: FATAL EXCEPTION: main
Process: at.wurz.david.recyclerviewtemplate, PID: 19738
android.content.ActivityNotFoundException: Unable to find explicit activity class {at.wurz.david.recyclerviewtemplate/at.wurz.david.recyclerviewtemplate.NotizBearbeiten}; have you declared this activity in your AndroidManifest.xml?
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1772)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1496)
at android.app.Activity.startActivityForResult(Activity.java:3780)
at android.app.Activity.startActivityForResult(Activity.java:3741)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:843)
at android.app.Activity.startActivity(Activity.java:4051)
at android.app.Activity.startActivity(Activity.java:4019)
at at.wurz.david.recyclerviewtemplate.RvAdapterKlasse$1.onClick(RvAdapterKlasse.java:60)
at android.view.View.performClick(View.java:4811)
at android.view.View$PerformClick.run(View.java:20136)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5546)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:964)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:759)
我该怎么办?我知道还有其他帖子,但没有解决方案帮助过我:(
现在stackoverflow告诉我我应该添加更多细节,但很抱歉我没有更多。我认为这是你需要知道的一切。