0 Replies - 2589 Views - Last Post: 23 April 2010 - 12:24 PM

#1 lnc12   User is offline

  • D.I.C Regular

Reputation: 1
  • View blog
  • Posts: 268
  • Joined: 21-May 08

Android: errors on TextView, Button and private DatePickerDialog.OnDat

Posted 23 April 2010 - 12:24 PM

Hey I've this code:
package com.example.datepickerdialog;

import java.util.Calendar;

import android.app.Activity;
import android.app.Dialog;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.Button;

public class DatePickerDialog extends Activity {
	private TextView mDateDisplay;
	private Button mPickDate;
	private int mYear;
	private int mMonth;
	private int mDate;
	static final int DATE_DIALOG_ID = 0;
    protected void onCreate(Bundle savedInstanceState) {
        //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) {
        //get the current date
        final Calendar c = Calendar.getInstance();
        mYear = c.get(Calendar.YEAR);
        mMonth = c.get(Calendar.MONTH);
        mDate = c.get(Calendar.DAY_OF_MONTH);
        //display the current date
    // updates the date in the TextView
    private void updateDisplay(){
    			new StringBuilder()
    				//Month is 0 based so add 1
    				.append(mMonth +1).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;
    protected Dialog onCreatDialog(int id){
    	case DATE_DIALOG_ID:
    		return new DatePickerDialog(this, mDateSetListener, mYear, mMonth, mDay);
    	return null;

And I get an error on the button and the textView, and that is "R.id can not be result" and on my private DatePickerDialog.OnDateSetListener I get this error "Can not be result" and I don't quiet get what is wrong, I'm following this guide:
Hope you can help :D

Is This A Good Question/Topic? 0
  • +

Page 1 of 1