-3

I want to show month and year only, how i can do it? I have been try to search some solution but for me it's not work. May be i need to create my custom date picker dialog ? Here is my code:

DatePickerDialog.OnDateSetListener d = new DatePickerDialog.OnDateSetListener() 
{


    public int Syear;
    public int Smonth;
    @Override

    public void onDateSet(DatePicker view, int year, int monthOfYear,
            int dayOfMonth) {
        calendar.set(Calendar.YEAR, year);
        calendar.set(Calendar.MONTH,monthOfYear);

            @Override
            public void onScrollStateChanged(AbsListView view,
                    int scrollState) {
                //  Auto-generated method stub


            }
        });

    }
};





public void setDate()
{
    new DatePickerDialog(InboxActivity.this,d,calendar.get(Calendar.YEAR),calendar.get(Calendar.MONTH),calendar.get(Calendar.DAY_OF_MONTH)).show();
}


@Override
public void onClick(View v) 
{
    this.setDate();
}    
user3323180
  • 43
  • 1
  • 7
  • Possible Duplicate: http://stackoverflow.com/questions/10673842/android-hide-date-field-in-datepickerdialog – Faisal Ali Apr 04 '14 at 16:28

1 Answers1

-1

May be this may work... not a tested solution though

import java.util.date;

SimpleDateFormat dateformat=new SimpleDateFormat("MM/yyyy");
dateformat.format(new Date());
Siva
  • 9,043
  • 12
  • 40
  • 63