【发布时间】:2014-05-01 14:24:53
【问题描述】:
我在这里阅读了很多,但没有任何帮助。
正如标题所说,我正在编写一个包含两个活动的简单 android 应用程序。第一个包括一个按钮。通过单击此第二个活动应该被激活。但是什么也没发生。
我的清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.schnitzeljagd"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.schnitzeljagd.UiActivity"
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="com.example.schnitzeljagd.showArchivements"
android:label="@string/app_name" >
</activity>
</application>
</manifest>
我的第一个活动是:
package com.example.schnitzeljagd;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
public class UiActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.ui_activitiy);
Button next = (Button) findViewById(R.id.button2);
final Intent intent = new Intent(this, showArchivements.class);
next.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
startActivity(intent); }
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
我的第二个:
package com.example.schnitzeljagd;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
public class showArchivements extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.ui_activitiy);
}
}
有人知道这里可能出了什么问题吗?
对不起,我的英语令人毛骨悚然,感谢您的回答!
【问题讨论】:
标签: android android-intent android-activity