调用意图时出现Android Studio运行时错误

调用意图时出现Android Studio运行时错误,android,android-intent,Android,Android Intent,当调用intent时,在调用intent的super.onCreate(Bundle)之前,我从一个活动转到另一个活动时遇到运行时错误。我记得有过类似的问题,但我不记得解决方法是什么,我是如何解决的。以下是两项活动: package com.erikstagg.tempo; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.text.Edita

当调用intent时,在调用intent的
super.onCreate(Bundle)
之前,我从一个活动转到另一个活动时遇到运行时错误。我记得有过类似的问题,但我不记得解决方法是什么,我是如何解决的。以下是两项活动:

package com.erikstagg.tempo;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;


public class register extends Activity {


    private EditText txtFname;
    private EditText txtLname;
    private EditText txtEmail;
    private EditText txtPhone;
    private Button btnNext;
    private TextView lblWarning;

    public static String Fname;
    public static String Lname;
    public static String email;
    public static String phone;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.register);

        txtFname = (EditText)findViewById((R.id.txtFname));
        txtLname = (EditText)findViewById((R.id.txtLname));
        txtEmail = (EditText)findViewById((R.id.txtEmail));
        txtPhone = (EditText)findViewById((R.id.txtPhone));
        lblWarning = (TextView)findViewById(R.id.lblWarning);
        txtFname.addTextChangedListener(watcher);
        txtLname.addTextChangedListener(watcher);
        txtEmail.addTextChangedListener(watcher);
        txtPhone.addTextChangedListener(watcher);
        btnNext = (Button)findViewById(R.id.btnNext);
        btnNext.setEnabled(false);

        txtFname.setText(Fname);
        txtLname.setText(Lname);
        txtEmail.setText(email);
        txtPhone.setText(phone);
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_register, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }

    private final TextWatcher watcher = new TextWatcher() {
        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after)
        { }
        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count)
        {}
        @Override
        public void afterTextChanged(Editable s) {
            if (txtFname.getText().toString().trim().length() == 0 ||
                    txtLname.getText().toString().trim().length() == 0 ||
                    txtEmail.getText().toString().trim().length() == 0 ||
                    txtPhone.getText().toString().trim().length() == 0) {
                btnNext.setEnabled(false);
                lblWarning.setVisibility(View.VISIBLE);
            } else {
                btnNext.setEnabled(true);
                lblWarning.setVisibility(View.INVISIBLE);
            }
        }
    };

    public void btnClicked(View v) {

        Fname = txtFname.getText().toString();
        Lname = txtLname.getText().toString();
        email = txtEmail.getText().toString();
        phone = txtPhone.getText().toString();

        switch(v.getId()){
            case R.id.btnBack:
                Intent intentBack = new Intent(this, login.class);
                startActivity(intentBack);
                break;
            case R.id.btnNext:
                Intent intentNext = new Intent(this, register2.class);
                startActivity(intentNext);
                break;
            default:
                break;
        }
    }
}
此活动称为:

package com.erikstagg.tempo;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;

import java.util.Arrays;


public class register2 extends Activity implements AdapterView.OnItemSelectedListener {

    private Spinner listBMonth;
    private ArrayAdapter<CharSequence> bMonthAdapter = ArrayAdapter.createFromResource(this, R.array.months, android.R.layout.simple_spinner_item);
    private Spinner listBDay;
    private ArrayAdapter<CharSequence> bDayAdapter = ArrayAdapter.createFromResource(this, R.array.days31, android.R.layout.simple_spinner_item);
    private Spinner listBYear;
    private ArrayAdapter<CharSequence> bYearAdapter = ArrayAdapter.createFromResource(this, R.array.years, android.R.layout.simple_spinner_item);

    private Spinner listCountry;
    private ArrayAdapter<CharSequence> countryAdapter = ArrayAdapter.createFromResource(this, R.array.countries, android.R.layout.simple_spinner_item);
    private Spinner listState;
    private ArrayAdapter<CharSequence> stateAdapter = ArrayAdapter.createFromResource(this, R.array.states, android.R.layout.simple_spinner_item);

    private EditText txtAddress;
    private EditText txtCity;
    private EditText txtZip;
    private Button btnNext;
    private TextView lblWarning;

    private int bMonthPos = -1;
    private int bDayPos = -1;
    private int bYearPos = -1;
    private int countryPos = -1;
    private int statePos = -1;
    public static String bDate;
    public static String country;
    public static String state;
    public static String address;
    public static String city;
    public static String zip;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.register2);

        listBMonth = (Spinner)findViewById((R.id.listMonth));
        listBDay = (Spinner)findViewById((R.id.listDay));
        listBYear = (Spinner)findViewById((R.id.listYear));
        listCountry = (Spinner)findViewById((R.id.listCountry));
        listState = (Spinner)findViewById((R.id.listState));
        txtCity = (EditText)findViewById((R.id.txtCity));
        txtZip = (EditText)findViewById((R.id.txtZip));
        txtAddress = (EditText)findViewById((R.id.txtAddress));
        lblWarning = (TextView)findViewById(R.id.lblWarning);
        txtAddress.addTextChangedListener(watcher);
        txtCity.addTextChangedListener(watcher);
        txtZip.addTextChangedListener(watcher);
        btnNext = (Button)findViewById(R.id.btnNext);
        btnNext.setEnabled(false);

        bMonthAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        listBMonth.setAdapter(bMonthAdapter);
        bDayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        listBDay.setAdapter(bDayAdapter);
        bYearAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        listBYear.setAdapter(bYearAdapter);
        countryAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        listCountry.setAdapter(countryAdapter);
        stateAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        listState.setAdapter(stateAdapter);

        listBMonth.setOnItemSelectedListener(this);
        listBDay.setOnItemSelectedListener(this);
        listBYear.setOnItemSelectedListener(this);
        listCountry.setOnItemSelectedListener(this);
        listState.setOnItemSelectedListener(this);

        if (bMonthPos != -1){
            listBMonth.setSelection(bMonthPos);
        }
        if (bDayPos != -1){
            listBDay.setSelection(bDayPos);
        }
        if (bYearPos != -1){
            listBYear.setSelection(bYearPos);
        }
        if (countryPos != -1){
            listBYear.setSelection(bYearPos);
        }
        if (statePos != -1){
            listBYear.setSelection(bYearPos);
        }
        txtAddress.setText(address);
        txtCity.setText(city);
        txtZip.setText(zip);
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_register2, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }

    private final TextWatcher watcher = new TextWatcher() {
        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after)
        { }
        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count)
        {}
        @Override
        public void afterTextChanged(Editable s) {
            checkIfFormCompleted();
        }
    };

    private void checkIfFormCompleted(){
        if (bMonthPos == -1 ||
                bDayPos == -1 ||
                bYearPos == -1 ||
                countryPos == -1 ||
                statePos == -1 ||
                txtAddress.getText().toString().trim().length() == 0 ||
                txtCity.getText().toString().trim().length() == 0 ||
                txtZip.getText().toString().trim().length() == 0) {
            btnNext.setEnabled(false);
            lblWarning.setVisibility(View.VISIBLE);
        } else {
            btnNext.setEnabled(true);
            lblWarning.setVisibility(View.INVISIBLE);
        }
    }

    public void onItemSelected(AdapterView<?> parent, View view, int position, long id)  {

        checkIfFormCompleted();
        bMonthPos = listBMonth.getSelectedItemPosition();
        bDayPos = listBDay.getSelectedItemPosition();
        bYearPos = listBYear.getSelectedItemPosition();
        countryPos = listCountry.getSelectedItemPosition();
        statePos = listState.getSelectedItemPosition();

        int[] months31 = {0, 2, 4, 6 , 7,9 , 11};
        int[] months30 = {3, 5, 8, 10};
        int[] months29 = {1};

        if (Arrays.asList(months31).contains(bMonthPos)){
            bDayAdapter.clear();
            bDayAdapter.addAll(getResources().getStringArray(R.array.days31));
            listBDay.setAdapter(bDayAdapter);
        }else if (Arrays.asList(months30).contains(bMonthPos)) {
            bDayAdapter.clear();
            bDayAdapter.addAll(getResources().getStringArray(R.array.days30));
            listBDay.setAdapter(bDayAdapter);
        }else if (Arrays.asList(months29).contains(bMonthPos)) {
            bDayAdapter.clear();
            bDayAdapter.addAll(getResources().getStringArray(R.array.days29));
            listBDay.setAdapter(bDayAdapter);
        }
    }

    // required function for "implements AdapterView.OnItemSelectedListener"
    public void onNothingSelected(AdapterView<?> parent) {
        // do nothing
    }

    public void btnClicked(View v) {

        bDate = listBMonth.getSelectedItem() + " - "
                + listBMonth.getSelectedItem() + " - "
                + listBMonth.getSelectedItem();
        country = getResources().getStringArray(R.array.countries)[countryPos];
        state = getResources().getStringArray(R.array.states)[statePos];
        address = txtAddress.getText().toString();
        city = txtCity.getText().toString();
        zip = txtZip.getText().toString();

        switch(v.getId()){
            case R.id.btnBack:
                Intent intentBack = new Intent(this, register.class);
                startActivity(intentBack);
                break;
            case R.id.btnNext:
                Intent intentNext = new Intent(this, register3.class);
                startActivity(intentNext);
                break;
            default:
                break;
        }
    }
}
package com.erikstagg.tempo;
导入android.app.Activity;
导入android.content.Intent;
导入android.os.Bundle;
导入android.text.Editable;
导入android.text.TextWatcher;
导入android.view.Menu;
导入android.view.MenuItem;
导入android.view.view;
导入android.widget.AdapterView;
导入android.widget.ArrayAdapter;
导入android.widget.Button;
导入android.widget.EditText;
导入android.widget.Spinner;
导入android.widget.TextView;
导入java.util.array;
公共类register2扩展活动实现AdapterView.OnItemSelectedListener{
私人微调器列表b月;
private ArrayAdapter bMonthAdapter=ArrayAdapter.createFromResource(这个,R.array.months,android.R.layout.simple\u微调器\u项);
私人微调器列表日期;
private ArrayAdapter bDayAdapter=ArrayAdapter.createFromResource(这个,R.array.days31,android.R.layout.simple\u微调器\u项);
私人纺纱机;
私有ArrayAdapter bYearAdapter=ArrayAdapter.createFromResource(这个,R.array.years,android.R.layout.simple\u微调器\u项);
私人纺纱厂;
private ArrayAdapter countryAdapter=ArrayAdapter.createFromResource(这个,R.array.countries,android.R.layout.simple\u微调器\u项);
私有微调器状态;
private ArrayAdapter stateAdapter=ArrayAdapter.createFromResource(这个,R.array.states,android.R.layout.simple\u微调器\u项);
私有编辑文本txtAddress;
私人编辑城市;
私有编辑文本txtZip;
私人按钮btnNext;
私有文本视图lblWarning;
私有整数bmmonthpos=-1;
私有int bDayPos=-1;
私有int bYearPos=-1;
私有int countryPos=-1;
私有int statePos=-1;
公共静态字符串bDate;
公共静态字符串国家;
公共静态字符串状态;
公共静态字符串地址;
公共静态字符串城市;
公共静态字符串压缩;
@凌驾
创建时受保护的void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.register2);
listBMonth=(微调器)findViewById((R.id.listMonth));
listBDay=(微调器)findViewById((R.id.listDay));
listBYear=(微调器)findViewById((R.id.listYear));
listCountry=(微调器)findViewById((R.id.listCountry));
listState=(微调器)findViewById((R.id.listState));
txtCity=(EditText)findViewById((R.id.txtCity));
txtZip=(EditText)findViewById((R.id.txtZip));
txtAddress=(EditText)findViewById((R.id.txtAddress));
lblWarning=(TextView)findViewById(R.id.lblWarning);
txtAddress.addTextChangedListener(观察者);
addTextChangedListener(观察者);
addTextChangedListener(观察者);
btnNext=(按钮)findViewById(R.id.btnNext);
btnNext.setEnabled(false);
b monthAdapter.setDropDownViewResource(android.R.layout.simple\u微调器\u下拉项);
listBMonth.setAdapter(bmmonthadapter);
bDayAdapter.setDropDownViewResource(android.R.layout.simple\u微调器\u下拉菜单\u项);
setAdapter(bDayAdapter);
bYearAdapter.setDropDownViewResource(android.R.layout.simple\u微调器\u下拉菜单\u项);
setAdapter(bYearAdapter);
countryAdapter.setDropDownViewResource(android.R.layout.simple\u微调器\u下拉菜单\u项);
setAdapter(countryAdapter);
stateAdapter.setDropDownViewResource(android.R.layout.simple\u微调器\u下拉菜单\u项);
setAdapter(stateAdapter);
listBMonth.setOnItemSelectedListener(此);
setOnItemSelectedListener(此);
setOnItemSelectedListener(此);
listCountry.setOnItemSelectedListener(此);
setOnItemSelectedListener(此);
如果(b月数!=-1){
listBMonth.setSelection(bmmonthpos);
}
如果(bDayPos!=-1){
listBDay.setSelection(bDayPos);
}
如果(bYearPos!=-1){
listBYear.setSelection(bYearPos);
}
如果(countryPos!=-1){
listBYear.setSelection(bYearPos);
}
如果(statePos!=-1){
listBYear.setSelection(bYearPos);
}
txtAddress.setText(地址);
txtCity.setText(城市);
setText(zip);
}
@凌驾
公共布尔onCreateOptions菜单(菜单){
//为菜单充气;这会将项目添加到操作栏(如果存在)。
getMenuInflater().充气(R.menu.menu\u寄存器2,菜单);
返回true;
}
@凌驾
公共布尔值onOptionsItemSelected(菜单项项){
//处理操作栏项目单击此处。操作栏将
//自动处理Home/Up按钮上的点击,只要
//在AndroidManifest.xml中指定父活动时。
int id=item.getItemId();
//noinspection SimplifiableIf语句
if(id==R.id.action\u设置){
返回true;
}
返回super.onOptionsItemSelected(项目);
}
私有最终TextWatcher watcher=新TextWatcher(){
@凌驾
更改前文本之前的公共void(字符序列s、int start、int count、int after)
{ }
@凌驾
public void onTextChanged(字符序列、int start、int before、int count)
{}
@凌驾
公共无效后文本已更改(可编辑){
checkIfFormCompleted();
}
};
私有无效检查已完成(){
如果(b个月位置==-1||
bDayPos==-1||
bYearPos==-1||
有限公司
04-30 10:09:52.421    4742-4742/com.erikstagg.tempo E/Zygote﹕ MountEmulatedStorage() 04-30 10:09:52.421    4742-4742/com.erikstagg.tempo E/Zygote﹕ v2 04-30 10:09:52.421    4742-4742/com.erikstagg.tempo E/SELinux﹕ [DEBUG] get_category: variable seinfo: default sensitivity: NULL, cateogry: NULL 04-30 10:12:38.981    4742-4742/com.erikstagg.tempo E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.erikstagg.tempo, PID: 4742
    java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.erikstagg.tempo/com.erikstagg.tempo.register2}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2641)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2855)
            at android.app.ActivityThread.access$900(ActivityThread.java:181)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1474)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:145)
            at android.app.ActivityThread.main(ActivityThread.java:6117)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
     Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference
            at android.content.ContextWrapper.getResources(ContextWrapper.java:90)
            at android.view.ContextThemeWrapper.getResources(ContextThemeWrapper.java:74)
            at android.widget.ArrayAdapter.createFromResource(ArrayAdapter.java:430)
            at com.erikstagg.tempo.register2.<init>(register2.java:24)
            at java.lang.reflect.Constructor.newInstance(Native Method)
            at java.lang.Class.newInstance(Class.java:1650)
            at android.app.Instrumentation.newActivity(Instrumentation.java:1079)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2631)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2855)
            at android.app.ActivityThread.access$900(ActivityThread.java:181)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1474)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:145)
            at android.app.ActivityThread.main(ActivityThread.java:6117)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
<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:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentTop="false"
        android:layout_alignParentStart="true">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:text="Account"
            android:id="@+id/register1textView"
            android:layout_gravity="center_horizontal"
            android:paddingBottom="50dp" />

        <EditText
            android:layout_width="230dp"
            android:layout_height="wrap_content"
            android:id="@+id/txtFname"
            android:layout_gravity="center_horizontal"
            android:hint="First Name"
            android:gravity="center"/>

        <EditText
            android:layout_width="230dp"
            android:layout_height="wrap_content"
            android:id="@+id/txtLname"
            android:layout_gravity="center_horizontal"
            android:hint="Last Name"
            android:gravity="center" />

        <EditText
            android:layout_width="230dp"
            android:layout_height="wrap_content"
            android:id="@+id/txtEmail"
            android:layout_gravity="center_horizontal"
            android:hint="Email"
            android:gravity="center" />

        <EditText
            android:layout_width="230dp"
            android:layout_height="wrap_content"
            android:id="@+id/txtPhone"
            android:layout_gravity="center_horizontal"
            android:hint="Phone Number"
            android:gravity="center" />

        <LinearLayout
            android:orientation="horizontal"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="Please fill out all fields!"
                android:id="@+id/lblWarning"
                android:gravity="center"
                android:enabled="false"
                android:visibility="invisible" />
        </LinearLayout>

    </LinearLayout>

    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:layout_weight=".5"
        android:gravity="bottom"
        android:layout_alignParentBottom="true">

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Back"
            android:id="@+id/btnBack"
            android:onClick="btnClicked"
            android:layout_weight="1" />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Next"
            android:id="@+id/btnNext"
            android:onClick="btnClicked"
            android:layout_weight="1" />
    </LinearLayout>

</RelativeLayout>
<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:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentStart="true"
        android:layout_weight="1"
        android:id="@+id/linearLayout"
        android:gravity="top|bottom">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:text="Profile Details"
            android:id="@+id/register1textView"
            android:layout_gravity="center_horizontal"
            android:paddingBottom="50dp" />

        <LinearLayout
            android:orientation="horizontal"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceSmall"
                android:text="Birthdate"
                android:id="@+id/textView2" />

            <Spinner
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/listMonth"
                android:layout_weight="1"/>

            <Spinner
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/listDay"
                android:layout_weight="1"/>

            <Spinner
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/listYear"
                android:layout_weight="1"/>
        </LinearLayout>

        <LinearLayout
            android:orientation="horizontal"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceSmall"
                android:text="Country"
                android:id="@+id/lblCountry" />

            <Spinner
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/listCountry"
                android:layout_weight="1"/>

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceSmall"
                android:text="State"
                android:id="@+id/lblState" />

            <Spinner
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/listState"
                android:layout_weight="1"/>
        </LinearLayout>

        <EditText
            android:layout_width="230dp"
            android:layout_height="wrap_content"
            android:id="@+id/txtAddress"
            android:layout_gravity="center_horizontal"
            android:hint="Address"
            android:gravity="center" />

        <EditText
            android:layout_width="230dp"
            android:layout_height="wrap_content"
            android:id="@+id/txtCity"
            android:layout_gravity="center_horizontal"
            android:hint="City"
            android:gravity="center" />

        <EditText
            android:layout_width="230dp"
            android:layout_height="wrap_content"
            android:id="@+id/txtZip"
            android:layout_gravity="center_horizontal"
            android:hint="Zip/Postal"
            android:gravity="center" />

        <LinearLayout
            android:orientation="horizontal"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="Please fill out all fields!"
                android:id="@+id/lblWarning"
                android:gravity="center"
                android:enabled="false"
                android:visibility="invisible" />
        </LinearLayout>

    </LinearLayout>

    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:layout_weight=".5"
        android:gravity="bottom"
        android:layout_alignParentBottom="true">

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Back"
            android:id="@+id/btnBack"
            android:onClick="btnClicked"
            android:layout_weight="1" />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Next"
            android:id="@+id/btnNext"
            android:onClick="btnClicked"
            android:layout_weight="1" />
    </LinearLayout>
</RelativeLayout>
private ArrayAdapter<CharSequence> bMonthAdapter = ArrayAdapter.createFromResource(this, R.array.months, android.R.layout.simple_spinner_item);