"Expression expected" error [closed]

0

I got this code that worked to some extent. But the updateLabel method I can not do because of the problem:

Ineedtopickthedateselectedfromthecalendar.I'musingaformwherebyclickingeditText,thecalendaropens.

finalDatePickerDialog.OnDateSetListenerdate=newDatePickerDialog.OnDateSetListener(){@OverridepublicvoidonDateSet(DatePickerview,intyear,intmonthOfYear,intdayOfMonth){//TODOAuto-generatedmethodstubmyCalendar.set(Calendar.YEAR,year);myCalendar.set(Calendar.MONTH,monthOfYear);myCalendar.set(Calendar.DAY_OF_MONTH,dayOfMonth);updateLabel(myCalendar);}};editText.setOnClickListener(newView.OnClickListener(){@OverridepublicvoidonClick(Viewv){//TODOAuto-generatedmethodstubnewDatePickerDialog(AgendamentoActivity.this,date,myCalendar.get(Calendar.YEAR),myCalendar.get(Calendar.MONTH),myCalendar.get(Calendar.DAY_OF_MONTH)).show();//Toast.makeText(getBaseContext(),"8:00 - 9:00", Toast.LENGTH_LONG).show();
        }
    });

    private void updateLabel(Calendar) {
        SimpleDateFormat dateFormat = new SimpleDateFormat("EEE MMM dd hh:mm:ss 'GMT'Z yyyy");
        System.out.println(dateFormat.format(myCalendar.getTime()));

        //editText.setText(sdf.format(myCalendar.getTime()));
    }
    
asked by anonymous 22.08.2017 / 20:23

2 answers

2

It seems to me that you're putting your updateLabel() method into onCreate when in fact it should be out. Here's an example:

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

}

public void updateLabel(){
    // aqui você coloca o código desejado
}
    
22.08.2017 / 21:04
0

Get your Calendar in updateLabel(Calendar myCalendar) and pass as argument to this same method within onDateSet .

    
22.08.2017 / 20:33