Android在活动开始时崩溃

时间:2011-07-17 15:24:46

标签: java android

每次启动此活动时,Android都会崩溃。这是代码。

import java.util.ArrayList;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

public class SettingsActivity extends Activity {
    EditText vname, vphone, vemail, vaddress;
    TextView textDeviceID;
    Button settings_submit;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        setContentView(R.layout.settingmenu);
        vname = (EditText) findViewById(R.id.get_name);
        vphone = (EditText) findViewById(R.id.get_phone);
        vemail = (EditText) findViewById(R.id.get_email);
        vaddress = (EditText) findViewById(R.id.get_address);
        settings_submit = (Button) findViewById(R.id.settings_submit);
        settings_submit.setOnClickListener(settings_submitOnClickListener);
        TextView textDeviceID = (TextView) findViewById(R.id.deviceid);
        super.onCreate(savedInstanceState);

        TelephonyManager telephonyManager = (TelephonyManager) getSystemService(

1 个答案:

答案 0 :(得分:1)

你应该告诉我们更多细节。但我发现一切看起来都很好,除了那个

super.onCreate(savedInstanceState);

应该在setContentView()和所有其他东西之前。顺便说一下,检查你的xml是否也有错误的配置控件。