I'm new at Android Development but I have a good level at iOS/Java Development.
I would like to use something like a Navigation Controller to travel between views (activities, I know) in my Android app. What should I use ?
Thanks for your advices.
I'm new at Android Development but I have a good level at iOS/Java Development.
I would like to use something like a Navigation Controller to travel between views (activities, I know) in my Android app. What should I use ?
Thanks for your advices.
Check out old class android.app.TabActivity or new one which is called Fragment. At elast TabActivity should be available in most of IDEs.
Here is an example of tab activity:
public class TabbedActivity extends TabActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Resources res = getResources(); // Resource object to get Drawables
TabHost tabHost = getTabHost(); // The activity TabHost
TabHost.TabSpec spec; // Resusable TabSpec for each tab
Intent intent; // Reusable Intent for each tab
// Create an Intent to launch an Activity for the tab (to be reused)
intent = new Intent().setClass(this, TasksActiveListActivity.class);
// Initialize a TabSpec for each tab and add it to the TabHost
spec = tabHost.newTabSpec("artists").setIndicator("Tasks",
res.getDrawable(R.drawable.ic_tab_artists))
.setContent(intent);
tabHost.addTab(spec);
// Do the same for the other tabs
intent = new Intent().setClass(this, StatisticActivity.class);
spec = tabHost.newTabSpec("albums").setIndicator("Statistic",
res.getDrawable(R.drawable.ic_tab_artists))
.setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, PurchaseActivity.class);
spec = tabHost.newTabSpec("albumz").setIndicator("Bonuses",
res.getDrawable(R.drawable.ic_tab_artists))
.setContent(intent);
tabHost.addTab(spec);
tabHost.setCurrentTab(0);
}
}
Use fragment instead of old and deprecated TabActivity
please Check out this Post:
Android UINavigationController-like feature