All the TagsFragment
class needs to do is display a list of tags from the appropriate table and when the user clicks one, let MainActivity
know via the ActivityComs
interface.
Add the ActivityComs
interface as a new member variable as highlighted in the following code:
public class TagsFragment extends ListFragment {
private ActivityComs mActivityComs;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
private ActivityComs mActivityComs;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
}
As we have seen upon just coding TitlesFragment
, the next code allows us to:
Get access to the database
Get the list of tags from
wis_table_tags
Set up
SimpleCursorAdapter
and bind it toListView
Add the highlighted code we have just discussed to the onCreate
method:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
DataManager...