KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am absolutely new to the Android platform and have been building an application while learning the development process. Currently, I am working on an activity in which i need to deploy 2 date pickers. One is a "Start Date" and the other is an "End date". I have been following the DatePicker tutorial on the android developers page here: http://developer.android.com/resources/tutorials/views/hello-datepicker.html For one DatePicker, it works just fine. Now my problem is, when I replicate the whole process for a second date picker, it shows up just fine on the emulator as well as on the handset. But when no matter which button I press to select the dates, only the first TextView is updated and the second TextView keeps showing the current date. Here is the code: package com.datepicker; import java.util.Calendar; import android.app.Activity; import android.app.DatePickerDialog; import android.app.Dialog; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.DatePicker; import android.widget.TextView; public class datepicker extends Activity { private TextView mDateDisplay; private TextView endDateDisplay; private Button mPickDate; private Button endPickDate; private int mYear; private int mMonth; private int mDay; static final int START_DATE_DIALOG_ID = 0; static final int END_DATE_DIALOG_ID = 0; /** Called when the activity is first created. */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); /* capture our View elements for the start date function */ mDateDisplay = (TextView) findViewById(R.id.startdateDisplay); mPickDate = (Button) findViewById(R.id.startpickDate); /* add a click listener to the button */ mPickDate.setOnClickListener(new V
Tags (comma-separated)
Save Edits
Cancel