I want to Get the Current Date from user after Getting the Current Date The Text view Want to Display Automatically the Date with 100 Days
ie if i select 15-12-2015 the Text view Want to Display 24-03-2016
here is My Code:
public class MainActivity extends ActionBarActivity implements View.OnClickListener {
private Button ib;
private Calendar cal;
private int day;
private int month;
private int year;
private EditText et;
private TextView display;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ib = (Button) findViewById(R.id.button);
cal = Calendar.getInstance();
day = cal.get(Calendar.DAY_OF_MONTH);
month = cal.get(Calendar.MONTH);
year = cal.get(Calendar.YEAR);
et = (EditText) findViewById(R.id.editText);
display = (TextView) findViewById(R.id.textView3);
ib.setOnClickListener((View.OnClickListener) this);
}
@Override
public void onClick(View v) {
showDialog(0);
}
@Override
@Deprecated
protected Dialog onCreateDialog(int id) {
return new DatePickerDialog(this, datePickerListener, year, month, day);
}
private DatePickerDialog.OnDateSetListener datePickerListener = new DatePickerDialog.OnDateSetListener() {
public void onDateSet(DatePicker view, int selectedYear,
int selectedMonth, int selectedDay) {
display.setText(selectedDay + 100) + " / " + (selectedMonth ) + " / "
+ selectedYear;
}
};