Most of the issues you are having are similar. I don't see where your variables are defined, they are instantiated but not defined anywhere. See http://developer.android.com/guide/tutorials/views/hello-datepicker.html
private int mYear; private int mMonth; private int mDay; static final int DATE_DIALOG_ID = 0; Hope this helps some. -Tope On Mon, Jun 21, 2010 at 9:53 AM, Varun Khanduja <varunkhand...@gmail.com> wrote: > > Hi, > > I am new to Android development, I have started to learn Java. However > as a beginner I am facing some issues. Here is the problem, your help > will be much appreciated. I started learning Java from and use Hello > android book to teach me some Java coding. Although what I have > learned from book has worked so far, however I tried to incorporate a > extra functionality of date-picker to see how I can use the Android > documentation and apply date picker functionality. > > Here are the list of problems I am facing > > 1. DATE_DIALOG_ID cannot be resolved. > 2. mDateDisplay cannot be resolved. > 3. mDay cannot be resolved > 4. mMonth cannot be resolved. > 5. mPickDate cannot be resolved > 6. Text view cannot be resolved to a type > 7. R.id.display cannot be resolved. > > Please help if your time permits. Thank you very much. > > > package org.example.sudoku; > > import android.app.Activity; > import android.content.Intent; > import android.os.Bundle; > import android.view.View; > import android.view.View.OnClickListener; > import java.util.Calendar; > import android.app.DatePickerDialog; > import android.app.Dialog; > > import android.widget.Button; > import android.widget.DatePicker; > import android.widget.Toast; > > > > public class sudoku extends Activity implements OnClickListener { > > > > /** Called when the activity is first created. */ > @Override > public void onCreate(Bundle savedInstanceState) { > super.onCreate(savedInstanceState); > setContentView(R.layout.main); > > // capture our View elements > mDateDisplay = (TextView) findViewById(R.id.dateDisplay); > mPickDate = (Button) findViewById(R.id.pickDate); > > // add a click listener to the button > mPickDate.setOnClickListener(new View.OnClickListener() { > public void onClick(View v) { > showDialog(DATE_DIALOG_ID); > } > }); > > // get the current date > final Calendar c = Calendar.getInstance(); > mYear = c.get(Calendar.YEAR); > mMonth = c.get(Calendar.MONTH); > mDay = c.get(Calendar.DAY_OF_MONTH); > > // display the current date > updateDisplay(); > > > // Set up click listeners for all the buttons > View continueButton = findViewById(R.id.continue_button); > continueButton.setOnClickListener(this); > View newButton = findViewById(R.id.new_button); > newButton.setOnClickListener(this); > View aboutButton = findViewById(R.id.about_button); > aboutButton.setOnClickListener(this); > View exitButton = findViewById(R.id.exit_button); > exitButton.setOnClickListener(this); > > > } > @Override > protected Dialog onCreateDialog(int id) { > switch (id) { > case DATE_DIALOG_ID: > return new DatePickerDialog(this, > mDateSetListener, > mYear, mMonth, mDay); > } > return null; > } > // updates the date we display in the TextView > private void updateDisplay() { > mDateDisplay.setText( > new StringBuilder() > // Month is 0 based so add 1 > .append(mMonth + 1).append("-") > .append(mDay).append("-") > .append(mYear).append(" ")); > } > > // the callback received when the user "sets" the date in the > dialog > private DatePickerDialog.OnDateSetListener mDateSetListener = > new DatePickerDialog.OnDateSetListener() { > > public void onDateSet(DatePicker view, int year, > int monthOfYear, int dayOfMonth) > { > mYear = year; > mMonth = monthOfYear; > mDay = dayOfMonth; > updateDisplay(); > } > }; > > // ... > public void onClick(View v) { > switch (v.getId()) { > case R.id.about_button: > Intent i = new Intent(this, About.class); > startActivity(i); > break; > // More buttons go here (if any) ... > > > > > > } > } > > > } > > -- > You received this message because you are subscribed to the Google > Groups "Android Beginners" group. > > NEW! Try asking and tagging your question on Stack Overflow at > http://stackoverflow.com/questions/tagged/android > > To unsubscribe from this group, send email to > android-beginners+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-beginners?hl=en > -- You received this message because you are subscribed to the Google Groups "Android Beginners" group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en