Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 32117212 authored by Andrew Solovay's avatar Andrew Solovay Committed by Android Git Automerger
Browse files

am 6c5bfa2f: am 026c82b1: Doc: Fixed a code sample to use standard methods....

am 6c5bfa2f: am 026c82b1: Doc: Fixed a code sample to use standard methods. Also some formatting tweaks.

* commit '6c5bfa2f':
  Doc: Fixed a code sample to use standard methods. Also some formatting tweaks.
parents 89ed56fa 6c5bfa2f
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -1126,8 +1126,8 @@ android.widget.SpinnerAdapter} by using {@link android.widget.ArrayAdapter} impl
uses a string array as the data source:</p>

<pre>
SpinnerAdapter mSpinnerAdapter = ArrayAdapter.createFromResource(this, R.array.action_list,
          android.R.layout.simple_spinner_dropdown_item);
SpinnerAdapter mSpinnerAdapter = ArrayAdapter.createFromResource(this,
        R.array.action_list, android.R.layout.simple_spinner_dropdown_item);
</pre>

<p>The {@link android.widget.ArrayAdapter#createFromResource createFromResource()} method takes
@@ -1179,10 +1179,13 @@ mOnNavigationListener = new OnNavigationListener() {
  public boolean onNavigationItemSelected(int position, long itemId) {
    // Create new fragment from our own Fragment class
    ListContentFragment newFragment = new ListContentFragment();
    FragmentTransaction ft = openFragmentTransaction();
    FragmentTransaction ft = getSupportFragmentManager().beginTransaction();

    // Replace whatever is in the fragment container with this fragment
    //  and give the fragment a tag name equal to the string at the position selected
    // and give the fragment a tag name equal to the string at the position
    // selected
    ft.replace(R.id.fragment_container, newFragment, strings[position]);

    // Apply changes
    ft.commit();
    return true;
@@ -1210,7 +1213,8 @@ public class ListContentFragment extends Fragment {
    &#64;Override
    public void onAttach(Activity activity) {
      // This is the first callback received; here we can set the text for
      // the fragment as defined by the tag specified during the fragment transaction
      // the fragment as defined by the tag specified during the fragment
      // transaction
      super.onAttach(activity);
      mText = getTag();
    }