In my app, I have added a splash screen and I have created the splash activity and made the appropriate changes to the manifest file. However, when I now run my app, the splash screen displays for its allotted time, and then returns a NullPointerException. The problem is being caused by
intent.getAction()
On line 241 of the class my splash redirects to, intent.getAction() is returning null. It is my understanding that the action is grabbed from the manifest file for the specified activity. That is correct isnt it? If so, can someone look at this and see if I have buggered something up? I see nothing wrong.
<activity android:name=".Main"
android:label="@string/app_name">
</activity>
<activity android:name=".SplashActivity" android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.GET_CONTENT" />
<data android:mimeType="*/*" />
<category android:name="android.intent.category.OPENABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
_________If statement that is retrieving the action______________
Intent intent = getIntent();
System.out.println("Intent action is " + intent.getAction());
if(intent.getAction().equals(Intent.ACTION_GET_CONTENT)) {
bimg[5].setVisibility(View.GONE);
mReturnIntent = true;
} else if (intent.getAction().equals(ACTION_WIDGET)) {
Log.e("MAIN", "Widget action, string = " + intent.getExtras().getString("folder"));
mHandler.updateDirectory(mFileMag.getNextDir(intent.getExtras().getString("folder"), true));
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…