Eclipse用手机运行安卓程序出错,显示xx已停止运行,代码如下。还有就是我直接新建一个工程不做修改,可以运行,求解决……
筱风子 2014-10-23 12:51:20 package com.example.lew02;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;
public class Lew_xianshi extends Activity {
private TextView mTextView01;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mTextView01 = (TextView) findViewById(R.id.myTextView01);
String str_2 = "欢迎来到我的安卓世界";
mTextView01.setText(str_2);
setContentView(R.layout.activity_main);
}
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.lew02.Lew_xianshi" >
<TextView
android:id="@+id/myTextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</RelativeLayout>