-4

I try to pass data using intent and i keep getting error. everything else is working except for the intent

05-16 12:58:15.624 15880-15880/com.example.user.talk E/AndroidRuntime: FATAL EXCEPTION: main
                                                                   Process: com.example.user.talk, PID: 15880
                                                                   java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.user.talk/com.example.user.talk.UpdateActivity}: java.lang.NullPointerException
                                                                       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2318)
                                                                       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2396)
                                                                       at android.app.ActivityThread.access$800(ActivityThread.java:139)
                                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1293)
                                                                       at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                       at android.os.Looper.loop(Looper.java:149)
                                                                       at android.app.ActivityThread.main(ActivityThread.java:5257)
                                                                       at java.lang.reflect.Method.invokeNative(Native Method)
                                                                       at java.lang.reflect.Method.invoke(Method.java:515)
                                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
                                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
                                                                       at dalvik.system.NativeStart.main(Native Method)
                                                                    Caused by: java.lang.NullPointerException
                                                                       at com.example.user.talk.UpdateActivity.onCreate(UpdateActivity.java:106)
                                                                       at android.app.Activity.performCreate(Activity.java:5411)
                                                                       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
                                                                       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2270)
                                                                       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2396) 
                                                                       at android.app.ActivityThread.access$800(ActivityThread.java:139) 
                                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1293) 
                                                                       at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                       at android.os.Looper.loop(Looper.java:149) 
                                                                       at android.app.ActivityThread.main(ActivityThread.java:5257) 
                                                                       at java.lang.reflect.Method.invokeNative(Native Method) 
                                                                       at java.lang.reflect.Method.invoke(Method.java:515) 
                                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 
                                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609) 
                                                                       at dalvik.system.NativeStart.main(Native Method) 

here is the image of both xml

http://i64.tinypic.com/2i7wv9h.png

http://i65.tinypic.com/ixr412.png

First java

public class ViewActivity extends AppCompatActivity implements View.OnClickListener {
ImageView bBack;

TextView Carname,Carmodel,Carprice, Unique, editTextEmail, Name, Phone, Nation, Passport,
        Pickup, Dropoff, Pickdate, Picktime, Dropdate, Droptime;
private Button buttonGet, delete;

private ProgressDialog loading;

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

    Unique = (TextView)findViewById(R.id.Unique);
    Carname = (TextView)findViewById(R.id.nameTxt);
    Carmodel = (TextView)findViewById(R.id.modelTxt);
    Carprice = (TextView)findViewById(R.id.priceTxt);
    editTextEmail = (TextView)findViewById(R.id.editTextEmail);
    Name = (TextView) findViewById(R.id.name);
    Phone = (TextView) findViewById(R.id.phone);
    Nation = (TextView) findViewById(R.id.country);
    Passport = (TextView) findViewById(R.id.passport);
    Pickup = (TextView)findViewById(R.id.pickup);
    Picktime = (TextView) findViewById(R.id.picktime);
    Pickdate = (TextView) findViewById(R.id.pickdate);
    Dropoff = (TextView)findViewById(R.id.dropoff);
    Droptime = (TextView) findViewById(R.id.droptime);
    Dropdate = (TextView) findViewById(R.id.dropdate);

    bBack = (ImageView) findViewById(R.id.imageView1);
    buttonGet = (Button) findViewById(R.id.buttonGet);
    Button Next = (Button) findViewById(R.id.bProceed);
    delete = (Button) findViewById(R.id.delete);
    buttonGet.setOnClickListener(this);


    Next.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent i = new Intent(getApplicationContext(), UpdateActivity.class);
            i.putExtra("uid", Unique.getText().toString());
            i.putExtra("priceTxt", Carprice.getText().toString());
            i.putExtra("nameTxt", Carname.getText().toString());
            i.putExtra("modelTxt", Carmodel.getText().toString());
            i.putExtra("email", editTextEmail.getText().toString());
            i.putExtra("name", Name.getText().toString());
            i.putExtra("phone", Phone.getText().toString());
            i.putExtra("nation", Nation.getText().toString());
            i.putExtra("passport", Passport.getText().toString());
            i.putExtra("pickup", Pickup.getText().toString());
            i.putExtra("pickdate", Pickdate.getText().toString());
            i.putExtra("picktime", Picktime.getText().toString());
            i.putExtra("dropoff", Dropoff.getText().toString());
            i.putExtra("droptime", Droptime.getText().toString());
            i.putExtra("dropdate", Dropdate.getText().toString());
            startActivity(i);
        }
    });






    delete.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            Intent intent = new Intent(ViewActivity.this, DeleteActivity.class);
            intent.putExtra("uid", Unique.getText().toString().trim());
            intent.putExtra("email", editTextEmail.getText().toString().trim());
            startActivity(intent);
        }
    });
    bBack.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            onBackPressed();
        }
    });
}

private void getData() {
    String uid = Unique.getText().toString().trim();
    String email = editTextEmail.getText().toString().trim();
    if (email.equals("")) {
        Toast.makeText(this, "NO RECORD FOUND", Toast.LENGTH_LONG).show();
        return;
    }
    if (uid.equals("")) {
        Toast.makeText(this, "NO RECORD FOUND", Toast.LENGTH_LONG).show();
        return;
    }

    if (email.equals("null")) {
        Toast.makeText(this,  "NO RECORD FOUND",  Toast.LENGTH_LONG).show();
        return;
    }




    loading = ProgressDialog.show(this, "Please wait...", "Fetching...", false, false);

    String url = Config.DATA_URL + editTextEmail.getText().toString().trim();

    StringRequest stringRequest = new StringRequest(url, new Response.Listener<String>() {
        @Override
        public void onResponse(String response) {
            loading.dismiss();
            showJSON(response);
        }
    },
            new Response.ErrorListener() {
                @Override
                public void onErrorResponse(VolleyError error) {
                    Toast.makeText(ViewActivity.this, error.getMessage().toString(), Toast.LENGTH_LONG).show();
                }
            });

    RequestQueue requestQueue = Volley.newRequestQueue(this);
    requestQueue.add(stringRequest);
}

private void showJSON(String response) {

    String uid = "";
    String priceTxt = "";
    String nameTxt = "";
    String modelTxt = "";
    String name = "";
    String phone = "";
    String nation = "";
    String passport = "";
    String pickup = "";
    String picktime = "";
    String pickdate = "";
    String dropoff = "";
    String droptime = "";
    String dropdate = "";
    try {
        JSONObject jsonObject = new JSONObject(response);
        JSONArray result = jsonObject.getJSONArray(Config.JSON_ARRAY);
        JSONObject collegeData = result.getJSONObject(0);
        uid = collegeData.getString(Config.KEY_UID);
        priceTxt = collegeData.getString(Config.KEY_CARPRICE);
        nameTxt = collegeData.getString(Config.KEY_CARNAME);
        modelTxt = collegeData.getString(Config.KEY_CARMODEL);
        name = collegeData.getString(Config.KEY_NAME);
        phone = collegeData.getString(Config.KEY_PHONE);
        nation = collegeData.getString(Config.KEY_NATION);
        passport = collegeData.getString(Config.KEY_PASSPORT);
        pickup = collegeData.getString(Config.KEY_PICKUP);
        picktime = collegeData.getString(Config.KEY_PICKTIME);
        pickdate = collegeData.getString(Config.KEY_PICKDATE);
        dropoff = collegeData.getString(Config.KEY_DROPOFF);
        droptime = collegeData.getString(Config.KEY_DROPTIME);
        dropdate = collegeData.getString(Config.KEY_DROPDATE);
    } catch (JSONException e) {
        e.printStackTrace();
    }
    Unique.setText(uid);
    Carprice.setText(priceTxt);
    Carname.setText(nameTxt);
    Carmodel.setText(modelTxt);
    Name.setText(name);
    Phone.setText(phone);
    Nation.setText(nation);
    Passport.setText(passport);
    Pickup.setText(pickup);
    Picktime.setText(picktime);
    Pickdate.setText(pickdate);
    Dropoff.setText(dropoff);
    Droptime.setText(droptime);
    Dropdate.setText(dropdate);


}

@Override
public void onClick(View v) {
    getData();
}
}

second

public class UpdateActivity extends AppCompatActivity implements View.OnClickListener {

private static final String REGISTER_URL = "http://192.168.0.7/uyirental/change.php";
public static final String USERID = "id";
public static final String CARNAME = "carname";
public static final String CARPRICE = "carprice";
public static final String CARMODEL = "carmodel";
public static final String USERNAME = "name";
public static final String USEREMAIL = "email";
public static final String USERPHONE = "phone";
public static final String USERNATION = "nation";
public static final String USERPASSPORT = "passport";
public static final String PICKUP = "pickup";
public static final String PICKTIME = "picktime";
public static final String PICKDATE = "pickdate";
public static final String DROPOFF = "dropoff";
public static final String DROPTIME = "droptime";
public static final String DROPDATE = "dropdate";

TextView nameTxt, priceTxt, modelTxt, Uid;
private ImageView bBack;
Button btnChangeDate, btnTimePicker, btnChangeDate2, btnTimePicker2, buttonRegister;
EditText tvDisplayDate, txtTime, tvDisplayDate2, txtTime2, Name, Phone, Email, Nation, Passport;


private int myear;
private int mmonth;
private int mday, mHour, mMinute;
AutoCompleteTextView autoTextView;
AutoCompleteTextView autoTextView1;

static final int DATE_DIALOG_ID = 999;


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


    setCurrentDateOnView();
    addListenerOnButton();

    Uid = (TextView)findViewById(R.id.uid);
    priceTxt = (TextView) findViewById(R.id.priceTxt);
    nameTxt = (TextView) findViewById(R.id.nameTxt);
    modelTxt = (TextView) findViewById(R.id.modelTxt);
    Name = (EditText) findViewById(R.id.Name);
    Email = (EditText) findViewById(R.id.Email);
    Phone = (EditText) findViewById(R.id.Phone);
    Nation = (EditText) findViewById(R.id.Nation);
    Passport = (EditText) findViewById(R.id.passport);
    autoTextView = (AutoCompleteTextView) findViewById(R.id.Pickup);
    autoTextView1 = (AutoCompleteTextView) findViewById(R.id.Dropoff);
    btnChangeDate = (Button) findViewById(R.id.btnChangeDate);
    btnTimePicker = (Button) findViewById(R.id.btn_time);
    btnChangeDate2 = (Button) findViewById(R.id.btnChangeDate2);
    btnTimePicker2 = (Button) findViewById(R.id.btn_time2);
    tvDisplayDate = (EditText) findViewById(R.id.Pickdate);
    txtTime = (EditText) findViewById(R.id.Picktime);
    tvDisplayDate2 = (EditText) findViewById(R.id.Dropdate);
    txtTime2 = (EditText) findViewById(R.id.Droptime);


    Uid.setText(getIntent().getStringExtra("uid"));
    nameTxt.setText(getIntent().getStringExtra("nameTxt"));
    modelTxt.setText(getIntent().getStringExtra("modelTxt"));
    priceTxt.setText(getIntent().getStringExtra("priceTxt"));
    Name.setText(getIntent().getStringExtra("name"));
    Email.setText(getIntent().getStringExtra("email"));
    Phone.setText(getIntent().getStringExtra("phone"));
    Nation.setText(getIntent().getStringExtra("nation"));
    Passport.setText(getIntent().getStringExtra("passport"));



    nameTxt.setText(getIntent().getStringExtra("nameTxt"));
    modelTxt.setText(getIntent().getStringExtra("modelTxt"));
    priceTxt.setText(getIntent().getStringExtra("priceTxt"));
    autoTextView.setText(getIntent().getStringExtra("pickup"));
    txtTime.setText(getIntent().getStringExtra("picktime"));
    tvDisplayDate.setText(getIntent().getStringExtra("pickdate"));
    autoTextView1.setText(getIntent().getStringExtra("dropoff"));
    txtTime2.setText(getIntent().getStringExtra("droptime"));
    tvDisplayDate2.setText(getIntent().getStringExtra("dropdate"));




    bBack = (ImageView) findViewById(R.id.imageView1);

    buttonRegister = (Button) findViewById(R.id.bProceed);

    buttonRegister.setOnClickListener(this);
    btnTimePicker.setOnClickListener(this);
    btnTimePicker2.setOnClickListener(this);


    String[] ADDRESS = {"81 ,Mission Road, Oredo, Edo, Nigeria",
            "Oba Yusuf Abiodun Way, Oniru Estate", "12 ,Onitsha Enugu Expressway, Anambra",
            "60, Forestry Road, Benin City, Benin City, Edo", "248, Ugbowo Lagos Road, Oredo, Benin City",
            "47, Siluko Road, Oredo, Benin City", "81A ,Ikwere Road, Mile 3 Diobu, Port Harcourt",
            "Plot 36, Blk 66 ,Kayode Taiwo Street, Magodo",
            "8 ,Milverton Avenue, Aba, Aba South, Abia, Nigeria"};

    String[] ADDRESS1 = {"81 ,Mission Road, Oredo, Edo, Nigeria",
            "Oba Yusuf Abiodun Way, Oniru Estate", "12 ,Onitsha Enugu Expressway, Anambra",
            "60, Forestry Road, Benin City, Benin City, Edo", "248, Ugbowo Lagos Road, Oredo, Benin City",
            "47, Siluko Road, Oredo, Benin City", "81A ,Ikwere Road, Mile 3 Diobu, Port Harcourt",
            "Plot 36, Blk 66 ,Kayode Taiwo Street, Magodo",
            "8 ,Milverton Avenue, Aba, Aba South, Abia, Nigeria"};

    autoTextView = (AutoCompleteTextView) findViewById(R.id.autocompleteEditTextView1);
    autoTextView1 = (AutoCompleteTextView) findViewById(R.id.autocompleteEditTextView2);
    ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(this,
            android.R.layout.select_dialog_item, ADDRESS);

    ArrayAdapter<String> arrayAdapter1 = new ArrayAdapter<String>(this,
            android.R.layout.select_dialog_item, ADDRESS1);

    //Used to specify minimum number of characters the user has to type in order to display the drop down hint.
    autoTextView.setThreshold(1);
    autoTextView1.setThreshold(1);

    //Setting adapter
    autoTextView.setAdapter(arrayAdapter);
    //Setting adapter
    autoTextView1.setAdapter(arrayAdapter);

    bBack.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(UpdateActivity.this, MainActivity.class);
            startActivity(intent);
        }
    });

}

private void registerUser(){
    final String id = Uid.getText().toString().trim();
    final String carname = nameTxt.getText().toString().trim();
    final String carprice = priceTxt.getText().toString().trim();
    final String carmodel = modelTxt.getText().toString().trim();
    final String name = Name.getText().toString().trim();
    final String email = Email.getText().toString().trim();
    final String phone = Phone.getText().toString().trim();
    final String nation = Nation.getText().toString().trim();
    final String passport = Passport.getText().toString().trim();
    final String pickup = autoTextView.getText().toString().trim();
    final String picktime = txtTime.getText().toString().trim();
    final String pickdate = tvDisplayDate.getText().toString().trim();
    final String dropoff = autoTextView1.getText().toString().trim();
    final String droptime = txtTime2.getText().toString().trim();
    final String dropdate = tvDisplayDate2.getText().toString().trim();

    if (pickup.equals("null")) {
        Toast.makeText(this, "Please enter all field",  Toast.LENGTH_LONG).show();
        return;
    }
    if (pickup.equals("")) {
        Toast.makeText(this,"Please enter all field",  Toast.LENGTH_LONG).show();
        return;
    }
    if (dropoff.equals("null")) {
        Toast.makeText(this, "Please enter all field", Toast.LENGTH_LONG).show();
        return;
    }
    if (dropoff.equals("")) {
        Toast.makeText(this,"Please enter all field",  Toast.LENGTH_LONG).show();
        return;
    }
    if (pickdate.equals("null")) {
        Toast.makeText(this, "Please enter all field",  Toast.LENGTH_LONG).show();
        return;
    }
    if (pickdate.equals("")) {
        Toast.makeText(this, "NO RECORD FOUND", Toast.LENGTH_LONG).show();
        return;
    }
    if (picktime.equals("null")) {
        Toast.makeText(this, "Please enter all field",  Toast.LENGTH_LONG).show();
        return;
    }
    if (picktime.equals("")) {
        Toast.makeText(this, "Please enter all field",  Toast.LENGTH_LONG).show();
        return;
    }
    if (droptime.equals("null")) {
        Toast.makeText(this, "Please enter all field",  Toast.LENGTH_LONG).show();
        return;
    }
    if (droptime.equals("")) {
        Toast.makeText(this, "Please enter all field",  Toast.LENGTH_LONG).show();
        return;
    }
    if (dropdate.equals("null")) {
        Toast.makeText(this, "Please enter all field",  Toast.LENGTH_LONG).show();
        return;
    }
    if (dropdate.equals("")) {
        Toast.makeText(this, "NO RECORD FOUND", Toast.LENGTH_LONG).show();
        return;
    }

    StringRequest stringRequest = new StringRequest(Request.Method.POST, REGISTER_URL,
            new Response.Listener<String>() {
                @Override
                public void onResponse(String response) {
                    Toast.makeText(UpdateActivity.this,response,Toast.LENGTH_LONG).show();
                    Intent intent = new Intent(UpdateActivity.this, ThankActivity.class);
                    startActivity(intent);
                    finish();
                }
            },
            new Response.ErrorListener() {
                @Override
                public void onErrorResponse(VolleyError error) {
                    Toast.makeText(UpdateActivity.this,error.toString(),Toast.LENGTH_LONG).show();
                }
            }){
        @Override
        protected Map<String,String> getParams(){
            Map<String,String> params = new HashMap<String, String>();
            params.put(USERID ,id);
            params.put(CARNAME ,carname);
            params.put(CARPRICE ,carprice);
            params.put(CARMODEL ,carmodel);
            params.put(USERNAME ,name);
            params.put(USEREMAIL ,email);
            params.put(USERPHONE ,phone);
            params.put(USERNATION ,nation);
            params.put(USERPASSPORT ,passport);
            params.put(PICKUP ,pickup);
            params.put(PICKTIME ,picktime);
            params.put(PICKDATE ,pickdate);
            params.put(DROPOFF ,dropoff);
            params.put(DROPTIME ,droptime);
            params.put(DROPDATE ,dropdate);
            return params;
        }

    };

    RequestQueue requestQueue = Volley.newRequestQueue(this);
    requestQueue.add(stringRequest);
}

@Override
public void onClick(View v) {
    if (v == buttonRegister) {
        registerUser();
    }



    if (v == btnTimePicker) {

        // Get Current Time
        final Calendar c = Calendar.getInstance();
        mHour = c.get(Calendar.HOUR_OF_DAY);
        mMinute = c.get(Calendar.MINUTE);

        // Launch Time Picker Dialog
        TimePickerDialog timePickerDialog = new TimePickerDialog(this,
                new TimePickerDialog.OnTimeSetListener() {

                    @Override
                    public void onTimeSet(TimePicker view, int hourOfDay,
                                          int minute) {

                        txtTime.setText(hourOfDay + ":" + minute);
                    }
                }, mHour, mMinute, false);
        timePickerDialog.show();
    }


    if (v == btnTimePicker2) {

        // Get Current Time
        final Calendar c = Calendar.getInstance();
        mHour = c.get(Calendar.HOUR_OF_DAY);
        mMinute = c.get(Calendar.MINUTE);

        // Launch Time Picker Dialog
        TimePickerDialog timePickerDialog = new TimePickerDialog(this,
                new TimePickerDialog.OnTimeSetListener() {

                    @Override
                    public void onTimeSet(TimePicker view, int hourOfDay,
                                          int minute) {

                        txtTime2.setText(hourOfDay + ":" + minute);
                    }
                }, mHour, mMinute, false);
        timePickerDialog.show();
    }
}


// display current date
public void setCurrentDateOnView() {

    tvDisplayDate = (EditText) findViewById(R.id.Pickdate);
    tvDisplayDate2 = (EditText) findViewById(R.id.Dropdate);

    final Calendar c = Calendar.getInstance();
    myear = c.get(Calendar.YEAR);
    mmonth = c.get(Calendar.MONTH);
    mday = c.get(Calendar.DAY_OF_MONTH);

    // set current date into textview
    tvDisplayDate.setText(new StringBuilder()
            // Month is 0 based, just add 1
            .append(mmonth + 1).append("-").append(mday).append("-")
            .append(myear).append(" "));

    // set current date into textview
    tvDisplayDate2.setText(new StringBuilder()
            // Month is 0 based, just add 1
            .append(mmonth + 1).append("-").append(mday + 1).append("-")
            .append(myear).append(" "));

}


public void addListenerOnButton() {

    btnChangeDate = (Button) findViewById(R.id.btnChangeDate);
    btnChangeDate2 = (Button) findViewById(R.id.btnChangeDate2);

    btnChangeDate.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {

            showDialog(DATE_DIALOG_ID);

        }

    });

    btnChangeDate2.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {

            showDialog(DATE_DIALOG_ID);

        }

    });

}

@Override
protected Dialog onCreateDialog(int id) {
    switch (id) {
        case DATE_DIALOG_ID:
            // set date picker as current date
            DatePickerDialog _date = new DatePickerDialog(this, datePickerListener, myear, mmonth,
                    mday) {
                @Override
                public void onDateChanged(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
                    if (year < myear)
                        view.updateDate(myear, mmonth, mday);

                    if (monthOfYear < mmonth && year == myear)
                        view.updateDate(myear, mmonth, mday);

                    if (dayOfMonth < mday && year == myear && monthOfYear == mmonth)
                        view.updateDate(myear, mmonth, mday);

                }
            };
            return _date;
    }
    return null;
}

private DatePickerDialog.OnDateSetListener datePickerListener = new DatePickerDialog.OnDateSetListener() {

    // when dialog box is closed, below method will be called.
    public void onDateSet(DatePicker view, int selectedYear,
                          int selectedMonth, int selectedDay) {
        myear = selectedYear;
        mmonth = selectedMonth;
        mday = selectedDay;

        // set selected date into textview
        tvDisplayDate.setText(new StringBuilder().append(mmonth + 1)
                .append("-").append(mday).append("-").append(myear)
                .append(" "));
    }

    private DatePickerDialog.OnDateSetListener datePickerListener = new DatePickerDialog.OnDateSetListener() {

        // when dialog box is closed, below method will be called.
        public void onDateSet(DatePicker view, int selectedYear,
                              int selectedMonth, int selectedDay) {
            myear = selectedYear;
            mmonth = selectedMonth;
            mday = selectedDay;

            // set selected date into textview
            tvDisplayDate2.setText(new StringBuilder().append(mmonth + 1)
                    .append("-").append(mday + 1).append("-").append(myear)
                    .append(" "));
        }


    };
};

}

Nizam
  • 1
  • 3

1 Answers1

0

autoTextView = (AutoCompleteTextView) findViewById(R.id.Pickup);

autoTextView1 = (AutoCompleteTextView) findViewById(R.id.Dropoff);

you have initialised these variables once but again trying to initialise them.

autoTextView = (AutoCompleteTextView) findViewById(R.id.autocompleteEditTextView1);

autoTextView1 = (AutoCompleteTextView) findViewById(R.id.autocompleteEditTextView2);

i think R.id.autocompleteEditTextView1 and R.id.autocompleteEditTextView2 are not present in your xml. when they are once no need to initialise them again.