我仍在学习编码,但我持续编码的应用程序无法在 2 个不同的设备上运行。Eclipse(最新的android sdk)可以是错误还是我每个应用程序都编码错误?它的力量在 2 台设备上关闭
public class MainActivity extends Activity {
Button dugme = (Button) findViewById(R.id.dugme);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
dugme.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
Cao();
}
});
}
private void Cao(){
Intent Cao = new Intent(this, Cao.class);
startActivity(Cao);
}}
这是曹班
public class Cao extends Activity{
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.cao);
}}
和清单
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.book1"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.book1.MainActivity"
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.book1.Cao"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.Action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application></manifest>