2016-04-09 29 views
0

Wenn ich 'NotizBearbeiten.java' (es ist eine Aktivität) öffnen, bekomme ich eine Ausnahme. Java:Aktivität nicht registriert, aber es ist

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); 
      } 
     }); 

Manifest:

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

Fehler:

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) 

Meine Projektstruktur

enter image description here

Was kann ich tun? Ich weiß, es gibt andere Posts, aber keine Lösung half mir :(

Jetzt sagt stackoverflow mir, dass ich mehr Details hinzufügen sollte, aber es tut mir leid, dass ich nicht mehr habe. Ich denke, das ist alles was Sie brauchen kennen.

+0

Können Sie den Paketnamen oben auf NotizBearbeiten.java überprüfen? – fractalwrench

+0

Es ist richtig. Die 'RecyclerViewActivity' funktioniert einwandfrei. – SomeRandomNameCuzWhyNot

+0

Reinigen Sie das Projekt und versuchen Sie es erneut –

Antwort

0

Versuchen sie das Projekt Aufräumen oder ungültig machen Caches ...

enter image description here

+0

Reinigung funktioniert! Danke :) – SomeRandomNameCuzWhyNot

+0

Sie sind herzlich willkommen :) –

0

überprüfen sie bitte Ihre Paketnamen, stellen sie sicher, ob NotizBearbeiten.java im Paketnamen at.wurz.david.recyclerviewtemplate ist, glaube ich, es ist nicht, daher die Ausnahme.

+0

Jede Klasse ist im selben Paket. Starten der 'RecycerViewActivity' funktioniert einwandfrei. – SomeRandomNameCuzWhyNot

+0

können Sie einen Screenshot Ihrer Projektstruktur anhängen? –

+0

Vielleicht versuchen Reinigung Projekt, LOL manchmal funktioniert es. –

Verwandte Themen