Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
11 Cards in this Set
- Front
- Back
What Dialog subclass will we use most often? |
AlertDialog |
|
What's the supposed problem with DatePickerDialog? |
a few bugs |
|
Benefit of wrapping AlertDialog in a DialogFragment as opposed to just using AlertDialog |
recommended procedure by Android if you don't wrap in DialogFragment, dialog will vanish if device is rotated |
|
create a DialogFragment |
1. create a new fragment class that extends DialogFragment 2. public Dialog onCreateDialog(Bundle onSavedInstanceState){ return new AlertDialog.Builder(getActivity()).setTitle(R.string.date_picker_title) .setPositiveButton(android.R.string.ok, null).create();} |
|
Three general categories of buttons you can add to a dialog |
positive button negative button neutral button |
|
What two methods can you call to get a DialogFragment added to the FragmentManager and then put on screen? |
public void show(FragmentManager manager, String tag) public void show(FragmentTransaction transaction, String tag) |
|
How do you add a DatePicker widget to an AlertDialog? |
public AlertDialog.Builder setView(View v) |
|
Example of adding DatePicker |
public Dialog onCreateDialog(Bundle onSavedInstanceState){ View v = getActivity().getLayoutInflater().inflate(R.layout.dialog_date, null); return new AlertDialog.Builder(getActivity()).setTitle(R.string.date_picker_title) .setView(v).setPositiveButton(android.R.string.ok, null).create();} |
|
How do you pass data between two fragments? |
create a newInstance(...) method and make the data and argument from the first fragment for the second fragment to use, and then add it as an extra on an Intent in onActivityResult(....) |
|
How do you initialize DatePicker? |
Use a Calendar object to get integers for day, month, year from a Date |
|
How do you track the relationship between two fragments in order to receive data back from a fragment? |
public void setTargetFragment(Fragment fragment, int requestCode); then call getTargetFragment() and getTargetRequestCode() to get the data |