我是Android的新手。
我尝试使用onBackPressed覆盖函数显示活动:
来自SesionesActivity
@Override
public void onBackPressed() {
Log.d("App", "on back pressed");
Intent intent = new Intent(SesionesActivity.this,
TutorialesActivity.class);
replaceContentView("TutorialesActivity", intent);
}
public void replaceContentView(String id, Intent newIntent) {
View view = getLocalActivityManager().startActivity(id,
newIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP))
.getDecorView();
this.setContentView(view);
}
但是当我运行应用程序时,我收到了这个错误:
您认为可能出错?
**编辑:**这是我的Android Manifest。
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.academia.moviles"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="13"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name="com.academia.app.AppController"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.Light.NoTitleBar" >
<activity
android:name=".TabHostActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".TutorialesActivity"
android:label="@string/title_activity_tutoriales" >
</activity>
<activity
android:name=".SesionesActivity"
android:label="@string/title_activity_sesiones" >
</activity>
</application>
</manifest>