Ich versuche, eine Benachrichtigung zu erstellen und anzuzeigen und auch einen Stapel zu der Absicht zu erstellen, die ich anzeigen. Aber ich bekomme eine NameNotFoundException.NameNotFoundException in addParentStack
Intent resultIntent = new Intent(mContext, ForecastFragment.class);
TaskStackBuilder stackBuilder = TaskStackBuilder.create(mContext);
stackBuilder.addParentStack(ForecastFragment.class);
stackBuilder.addNextIntent(resultIntent);
PendingIntent resultPendingIntent = stackBuilder.
getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
mBuilder.setContentIntent(resultPendingIntent);
NotificationManager notificationManager =
(NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(10 ,mBuilder.build());
Hier ist die Ausnahme, die ich bekomme.
3541-3562/com.example.android.sunshine.app E/AndroidRuntime: FATAL EXCEPTION: SyncAdapterThread-1
Process: com.example.android.sunshine.app, PID: 3541
java.lang.IllegalArgumentException: android.content.pm.PackageManager$NameNotFoundException: ComponentInfo{com.example.android.sunshine.app/com.example.android.sunshine.app.ForecastFragment}
at android.support.v4.app.TaskStackBuilder.addParentStack(TaskStackBuilder.java:247)
at android.support.v4.app.TaskStackBuilder.addParentStack(TaskStackBuilder.java:226)
at com.example.android.sunshine.app.sync.SunshineSyncAdapter.notifyWeather(SunshineSyncAdapter.java:526)
at com.example.android.sunshine.app.sync.SunshineSyncAdapter.getWeatherDataFromJson(SunshineSyncAdapter.java:424)
at com.example.android.sunshine.app.sync.SunshineSyncAdapter.onPerformSync(SunshineSyncAdapter.java:255)
at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:259)
Caused by: android.content.pm.PackageManager$NameNotFoundException: ComponentInfo{com.example.android.sunshine.app/com.example.android.sunshine.app.ForecastFragment}
at android.app.ApplicationPackageManager.getActivityInfo(ApplicationPackageManager.java:314)
at android.support.v4.app.NavUtils.getParentActivityName(NavUtils.java:301)
at android.support.v4.app.NavUtils.getParentActivityIntent(NavUtils.java:256)
at android.support.v4.app.TaskStackBuilder.addParentStack(TaskStackBuilder.java:240)
at android.support.v4.app.TaskStackBuilder.addParentStack(TaskStackBuilder.java:226)
at com.example.android.sunshine.app.sync.SunshineSyncAdapter.notifyWeather(SunshineSyncAdapter.java:526)
at com.example.android.sunshine.app.sync.SunshineSyncAdapter.getWeatherDataFromJson(SunshineSyncAdapter.java:424)
at com.example.android.sunshine.app.sync.SunshineSyncAdapter.onPerformSync(SunshineSyncAdapter.java:255)
at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:259)
überprüfte ich den Paketnamen und das Paket, in dem die Klasse ForecastFragment
platziert ist, aber es ist alles in Ordnung. Kann mir bitte jemand helfen, diesen zu sortieren.
Danke, das hat mein Problem behoben. –