Problem with DatePickerDialog

0

I bought a book to study Android, I'm following and trying to understand how the components work

When I click on a button, I need to open a modal with the date component.

I'm using the SDK 19 with Android 4.2, and when in some method triggered by the click of the button, I call a showDialog , it returns me

  

The method showDialog (int) from the type Activity is deprecated

It looks like something related by the version of the SDK I'm using.

    
asked by anonymous 19.04.2014 / 17:21

1 answer

1

This information has nothing to do with the version of the SDK, but with the use of the showDialog method that is considered outdated.

Starting from version 3.0 (SDK 11) a new way of using the "Dialogs" , which is named DialogFragment , has been introduced.

In practical terms, this does not prevent you from continuing to use the showDialog method, however "Android team" recommends using DialogFragment .

As you are getting started with Android, I recommend that you ignore this message for now. When you have more experience then start exploring Fragments .

If you do not want to follow my advice, see here how to use a DatePicker with DialogFragment .

    
20.04.2014 / 00:06