How to calculate age from D.O.B?
<p>I want to calculate age from D.O.B. I am getting date of birth from below code. Now i want to calculate user age and I want to show age in another textView. How can I achieve this ?</p>

<pre><code>dateFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US);

public void setDateTimeField() {
        date();

        Calendar newCalendar = Calendar.getInstance();
        fromDatePickerDialog = new DatePickerDialog(getActivity(), new DatePickerDialog.OnDateSetListener() {

            public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
                Calendar newDate = Calendar.getInstance();
                newDate.set(year, monthOfYear, dayOfMonth);
                txtDatePicker.setText(dateFormatter.format(newDate.getTime()));
            }

        },newCalendar.get(Calendar.YEAR), newCalendar.get(Calendar.MONTH), newCalendar.get(Calendar.DAY_OF_MONTH));

    }

    public void date(){

        txtDatePicker.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                fromDatePickerDialog.show();
            }
        });
    }
</code></pre>