[英]Is it possible that Android App will not launch the MainActivity?
I am facing issue with my activity with main intent filter is not created. 我的主要意图过滤器未创建活动时遇到问题。 Also, it is not giving me any crash.
另外,它不会给我带来任何崩溃。
Here is my AndroidManifest.xml 这是我的AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="tracker.com.tracker">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:name=".Tracker"
>
<activity
android:name=".TrackActivity"
android:label="@string/app_name"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
And here is the code for my TrackActivity: 这是我的TrackActivity的代码:
import android.os.Bundle;
import android.os.PersistableBundle;
import android.util.Log;
public class TrackActivity extends BaseActivity {
@Override
public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
super.onCreate(savedInstanceState, persistentState);
setContentView(R.layout.activity_track);
Log.d("Track","I am created");
setHeaderTitle("Track");
hideLeftMenuButton();
setRightMenuButtonText("Show Stats");
}
}
Here are the results: 结果如下:
What may be the possible reason for the same? 相同的可能原因是什么?
Change 更改
public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState)
to 至
protected void onCreate(Bundle savedInstanceState)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.