Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private class SlideMenuClickListener implements
- ListView.OnItemClickListener {
- @Override
- public void onItemClick(AdapterView<?> parent, View view, int position,
- long id) {
- // display view for selected nav drawer item
- displayView(position);
- }
- }
- private void displayView(int position) {
- // update the main content by replacing fragments
- Fragment fragment = null;
- switch (position) {
- case 0:
- fragment = new GalleryFragment();
- break;
- case 1:
- fragment = new FindPeopleFragment();
- break;
- case 2:
- fragment = new PhotosFragment();
- break;
- default:
- break;
- }
- public class GalleryFragment extends Fragment {
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- View rootView = inflater.inflate(R.layout.chapter, container, false);
- Intent i = new Intent(getActivity(), GalleryActivity.class);
- startActivity(i);
- return rootView;
- }
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical" >
- </LinearLayout>
- public class GalleryActivity extends Activity {
- TextView textView1;
- @Override
- protected void onCreate(Bundle savedInstanceState){
- super.onCreate(savedInstanceState);
- setContentView(R.layout.gallery_activity);
- textView1=(TextView)findViewById(R.id.textView1);
- }
- }
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical" >
- <TextView
- android:id="@+id/textView1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Lesson Page" />
- </LinearLayout>
- Intent i = new Intent(context, GalleryActivity.class);
- startActivity(i);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement