diff options
author | Andrew Solovay <asolovay@google.com> | 2014-04-23 02:47:50 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-04-23 02:47:50 +0000 |
commit | 32117212fc48872b557044ff25ba6b8d9ace5738 (patch) | |
tree | f498dfd16def3fe92c06ab4d09183afbf6f08689 /docs/html/guide/topics/ui | |
parent | 89ed56fa6c5951e4ce7ea555ae8f90c65b2daa2d (diff) | |
parent | 6c5bfa2f348f1d55cbff5f8f2bd61e88ac2d01ee (diff) | |
download | frameworks_base-32117212fc48872b557044ff25ba6b8d9ace5738.zip frameworks_base-32117212fc48872b557044ff25ba6b8d9ace5738.tar.gz frameworks_base-32117212fc48872b557044ff25ba6b8d9ace5738.tar.bz2 |
am 6c5bfa2f: am 026c82b1: Doc: Fixed a code sample to use standard methods. Also some formatting tweaks.
* commit '6c5bfa2f348f1d55cbff5f8f2bd61e88ac2d01ee':
Doc: Fixed a code sample to use standard methods. Also some formatting tweaks.
Diffstat (limited to 'docs/html/guide/topics/ui')
-rw-r--r-- | docs/html/guide/topics/ui/actionbar.jd | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/docs/html/guide/topics/ui/actionbar.jd b/docs/html/guide/topics/ui/actionbar.jd index 762d30c..f01d4bf 100644 --- a/docs/html/guide/topics/ui/actionbar.jd +++ b/docs/html/guide/topics/ui/actionbar.jd @@ -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 { @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(); } |