帮帮忙,急!!!!
我在Debug时,console框中也出现ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.android.Example1/.Example1 }
然后AVD中出现应用程序以外停止,请重试的提示,为什么?代码如下:
package com.android.Example1;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
//import android.widget.Toast;public class Example1 extends Activity {
//private static final String TAG = "Example1";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//Listen for button clicks
Button button =(Button)findViewById(R.id.makesure);
button.setOnClickListener(calcExample1);
}
private OnClickListener calcExample1 = new OnClickListener(){
public void onClick(View v){
EditText fieldcontent = (EditText)findViewById(R.id.content);
TextView display = (TextView)findViewById(R.id.display);
display.setText(fieldcontent.getText());
}
};}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.Example1"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android">
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="请输入内容"
/>
<EditText android:id="@+id/content"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:text=""
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="显示输入内容"
/>
<TextView android:id="@+id/display"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=""
/>
<Button android:id="@+id/makesure"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="确定"
/>
</LinearLayout> <application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".Example1"
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>
</manifest>
我在Debug时,console框中也出现ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.android.Example1/.Example1 }
然后AVD中出现应用程序以外停止,请重试的提示,为什么?代码如下:
package com.android.Example1;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
//import android.widget.Toast;public class Example1 extends Activity {
//private static final String TAG = "Example1";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//Listen for button clicks
Button button =(Button)findViewById(R.id.makesure);
button.setOnClickListener(calcExample1);
}
private OnClickListener calcExample1 = new OnClickListener(){
public void onClick(View v){
EditText fieldcontent = (EditText)findViewById(R.id.content);
TextView display = (TextView)findViewById(R.id.display);
display.setText(fieldcontent.getText());
}
};}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.Example1"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android">
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="请输入内容"
/>
<EditText android:id="@+id/content"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:text=""
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="显示输入内容"
/>
<TextView android:id="@+id/display"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=""
/>
<Button android:id="@+id/makesure"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="确定"
/>
</LinearLayout> <application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".Example1"
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>
</manifest>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货