March 2013
Beginner to intermediate
580 pages
16h 11m
English
The next logical thing to do is allow the user to navigate from the list of runs to the details of a specific run. In order for this to work well, RunFragment needs some support for passing a run ID as an argument. Since you host RunFragment in RunActivity, it too needs an extra for the run ID.
First, add the argument to RunFragment and a newInstance(long) method to make it easier to use.
Listing 34.18 Adding a run ID argument (RunFragment.java)
public class RunFragment extends Fragment {
private static final String TAG = "RunFragment";
private static final String ARG_RUN_ID = "RUN_ID";
...
private TextView mStartedTextView, mLatitudeTextView,
mLongitudeTextView, mAltitudeTextView, mDurationTextView;
public static RunFragment ...Read now
Unlock full access