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>
- <?xml version="1.0" encoding="utf-8"?>
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.wave"
- android:versionCode="1"
- android:versionName="1.0" >
- <uses-sdk
- android:minSdkVersion="17"
- android:targetSdkVersion="19" />
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
- <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
- <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
- <uses-permission android:name="android.permission.INTERNET" />
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@style/AppTheme" >
- <activity
- android:name="com.example.wave.MainActivity"
- android:screenOrientation="portrait"
- >
- </activity>
- <activity
- android:name="com.example.wave.SplashActivity"
- android:screenOrientation="portrait"
- android:label="@string/app_name" >
- <intent-filter>
- <action android:name="android.intent.action.MAIN"
- />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <activity
- android:name="com.example.wave.GalleryActivity"
- android:label="@string/chapter_title"
- android:parentActivityName="com.example.wave.MainActivity" >
- <meta-data
- android:name="android.support.PARENT_ACTIVITY"
- android:value="com.example.wave.MainActivity" />
- </activity>
- </application>
- </manifest>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement