The following is the first few sections of a chapter from Exploring Android, plus headings for the remaining major sections, to give you an idea about the content of the chapter.
We are storing things, like notes, in the ToDoModel
that do not appear in
the roster list. That sort of list usually shows limited information, with
the rest of the details shown when you tap on an item in the list. That is
the approach that we will use here, where we will show a separate fragment
with the details of the to-do item when the user taps on the item.
This is a continuation of the work we did in the previous tutorial. The book’s GitHub repository contains the results of the previous tutorial as well as the results of completing the work in this tutorial.
Once again, we need to set up a fragment.
Right-click over the com.commonsware.todo
package in the java/
directory
and choose “New” > “Java Class” from the context menu. This will bring up a dialog
where we can define a new Java class. For the name, fill in DisplayFragment
.
For the superclass, fill in android.support.v4.app.Fragment
. Click “OK”
to create the class.
That will give you a DisplayFragment
that looks like:
package com.commonsware.todo;
import android.support.v4.app.Fragment;
public class DisplayFragment extends Fragment {
}
The preview of this section is [REDACTED].
The preview of this section is off trying to sweet-talk the Khaleesi into providing us with a dragon.
The preview of this section took that left turn at Albuquerque.
The preview of this section is sleeping in.
The preview of this section is [REDACTED].
The preview of this section was eaten by a grue.
The preview of this section will not appear here for a while, due to a time machine mishap.
The preview of this section is [REDACTED].
The preview of this section was eaten by a grue.
The preview of this section is [REDACTED].
The preview of this section may contain nuts.