开发者

Android crashing on activity start

开发者 https://www.devze.com 2023-03-20 17:31 出处:网络
Android crashes whenever this activity is started. here is the code. import java.util.ArrayList; import org.apache.http.NameValuePair;

Android crashes whenever this activity is started. here is the code.

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 textD开发者_如何转开发eviceID = (TextView) findViewById(R.id.deviceid);
        super.onCreate(savedInstanceState);

        TelephonyManager telephonyManager = (TelephonyManager) getSystemService(


you should tell us more details. But I see that everything looks fine, except that

super.onCreate(savedInstanceState);

should go before setContentView() and all other stuff. By the way, check your xml for bad config controls too.

0

精彩评论

暂无评论...
验证码 换一张
取 消