写了一个小程序,eclipse没有报错,警告都没有,放到手机上就总是显示已停止运行。这是代码:
MainActivity.java:
package redknot.com.example.redphone;
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 MainActivity extends Activity {
    private Button buttonphone;
    private Button buttontext;    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        buttonphone = (Button) findViewById(R.id.buttonphone);
        buttontext = (Button) findViewById(R.id.buttontext);
        
        buttonphone.setOnClickListener(new Button.OnClickListener(){ @Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent intentphone = new Intent(MainActivity.this,Phone.class);
startActivity(intentphone);
}
        
        });
        
        buttontext.setOnClickListener(new Button.OnClickListener(){ @Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intenttext = new Intent(MainActivity.this,Text.class);
startActivity(intenttext);
}
        
        });
        
     
    }
    @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;
    }
    
}
activity_main.xml<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
    
    <Button 
        android:id="@+id/buttonphone"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/gotophone"
        />
    <Button 
        android:id="@+id/buttontext"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/gototext"
        />
</LinearLayout>Android手机Eclipse