project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/netplay/TestActivity.java
changeset 7349 12fdfd2038d4
parent 7346 b0f67c5b4215
child 7352 641f11cdd319
equal deleted inserted replaced
7346:b0f67c5b4215 7349:12fdfd2038d4
     1 package org.hedgewars.hedgeroid.netplay;
       
     2 
       
     3 import org.hedgewars.hedgeroid.R;
       
     4 
       
     5 import android.os.Bundle;
       
     6 import android.support.v4.app.Fragment;
       
     7 import android.support.v4.app.FragmentActivity;
       
     8 import android.support.v4.app.FragmentManager;
       
     9 import android.support.v4.app.FragmentPagerAdapter;
       
    10 import android.support.v4.view.ViewPager;
       
    11 
       
    12 public class TestActivity extends FragmentActivity {
       
    13 	@Override
       
    14 	protected void onCreate(Bundle arg0) {
       
    15 		super.onCreate(arg0);
       
    16 		setContentView(R.layout.activity_lobby_paged);
       
    17 		ViewPager pager = (ViewPager)findViewById(R.id.pager);
       
    18 		pager.setAdapter(new Adapter(getSupportFragmentManager()));
       
    19 	}
       
    20 	
       
    21 	private static class Adapter extends FragmentPagerAdapter {
       
    22 		public Adapter(FragmentManager mgr) {
       
    23 			super(mgr);
       
    24 		}
       
    25 		
       
    26 		@Override
       
    27 		public int getCount() {
       
    28 			return 3;
       
    29 		}
       
    30 		
       
    31 		@Override
       
    32 		public Fragment getItem(int arg0) {
       
    33 			switch(arg0) {
       
    34 			case 0: return new RoomlistFragment();
       
    35 			case 1: return new LobbyChatFragment();
       
    36 			case 2: return new PlayerlistFragment();
       
    37 			default: throw new IndexOutOfBoundsException();
       
    38 			}
       
    39 		}
       
    40 	}
       
    41 }