Advertisement
Guest User

Untitled

a guest
Nov 1st, 2014
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.93 KB | None | 0 0
  1. private class SlideMenuClickListener implements
  2. ListView.OnItemClickListener {
  3. @Override
  4. public void onItemClick(AdapterView<?> parent, View view, int position,
  5. long id) {
  6. // display view for selected nav drawer item
  7. displayView(position);
  8. }
  9. }
  10.  
  11.  
  12. private void displayView(int position) {
  13. // update the main content by replacing fragments
  14. Fragment fragment = null;
  15. switch (position) {
  16. case 0:
  17. fragment = new GalleryFragment();
  18. break;
  19. case 1:
  20. fragment = new FindPeopleFragment();
  21. break;
  22. case 2:
  23. fragment = new PhotosFragment();
  24. break;
  25.  
  26. default:
  27. break;
  28. }
  29.  
  30. public class GalleryFragment extends Fragment {
  31.  
  32. @Override
  33. public View onCreateView(LayoutInflater inflater, ViewGroup container,
  34. Bundle savedInstanceState) {
  35.  
  36. View rootView = inflater.inflate(R.layout.chapter, container, false);
  37.  
  38. Intent i = new Intent(getActivity(), GalleryActivity.class);
  39. startActivity(i);
  40.  
  41. return rootView;
  42. }
  43.  
  44. <?xml version="1.0" encoding="utf-8"?>
  45. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  46. android:layout_width="match_parent"
  47. android:layout_height="match_parent"
  48. android:orientation="vertical" >
  49.  
  50. </LinearLayout>
  51.  
  52. public class GalleryActivity extends Activity {
  53.  
  54. TextView textView1;
  55.  
  56. @Override
  57. protected void onCreate(Bundle savedInstanceState){
  58. super.onCreate(savedInstanceState);
  59. setContentView(R.layout.gallery_activity);
  60.  
  61. textView1=(TextView)findViewById(R.id.textView1);
  62.  
  63.  
  64. }
  65.  
  66. }
  67.  
  68. <?xml version="1.0" encoding="utf-8"?>
  69. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  70. android:layout_width="match_parent"
  71. android:layout_height="match_parent"
  72. android:orientation="vertical" >
  73.  
  74. <TextView
  75. android:id="@+id/textView1"
  76. android:layout_width="wrap_content"
  77. android:layout_height="wrap_content"
  78. android:text="Lesson Page" />
  79.  
  80. </LinearLayout>
  81.  
  82. <?xml version="1.0" encoding="utf-8"?>
  83. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  84. package="com.example.wave"
  85. android:versionCode="1"
  86. android:versionName="1.0" >
  87.  
  88. <uses-sdk
  89. android:minSdkVersion="17"
  90. android:targetSdkVersion="19" />
  91.  
  92. <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  93. <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
  94. <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
  95. <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  96. <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
  97. <uses-permission android:name="android.permission.INTERNET" />
  98.  
  99. <application
  100. android:allowBackup="true"
  101. android:icon="@drawable/ic_launcher"
  102. android:label="@string/app_name"
  103. android:theme="@style/AppTheme" >
  104.  
  105. <activity
  106. android:name="com.example.wave.MainActivity"
  107. android:screenOrientation="portrait"
  108. >
  109. </activity>
  110.  
  111. <activity
  112. android:name="com.example.wave.SplashActivity"
  113. android:screenOrientation="portrait"
  114. android:label="@string/app_name" >
  115. <intent-filter>
  116. <action android:name="android.intent.action.MAIN"
  117. />
  118.  
  119. <category android:name="android.intent.category.LAUNCHER" />
  120. </intent-filter>
  121. </activity>
  122.  
  123.  
  124.  
  125.  
  126. <activity
  127. android:name="com.example.wave.GalleryActivity"
  128. android:label="@string/chapter_title"
  129. android:parentActivityName="com.example.wave.MainActivity" >
  130. <meta-data
  131. android:name="android.support.PARENT_ACTIVITY"
  132. android:value="com.example.wave.MainActivity" />
  133. </activity>
  134.  
  135. </application>
  136. </manifest>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement