Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.logs.log_tables;
- import android.app.Activity;
- import android.os.Bundle;
- import android.view.View;
- public class FormulaAndTablesActivity extends Activity {
- Integer current_menu;
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- Integer location = null;
- location = (savedInstanceState == null) ? null : savedInstanceState.getInt("location");
- if(location == null) {
- setContentView(R.layout.main_menu);
- }
- else {
- switch(location) {
- case 0: current_menu = 0; setContentView(R.layout.main_menu); break;
- case 1: current_menu = 1; setContentView(R.layout.mechanics_menu); break;
- case 2: current_menu = 2; setContentView(R.layout.statistics_menu); break;
- case 3: current_menu = 3; setContentView(R.layout.coordinate_geo); break;
- case 4: current_menu = 4; setContentView(R.layout.trigonometry); break;
- case 5: current_menu = 5; setContentView(R.layout.logs); break;
- default: current_menu = 0; setContentView(R.layout.main_menu); break;
- }
- }
- }
- @Override
- protected void onSaveInstanceState(Bundle out_state) {
- super.onSaveInstanceState(out_state);
- Integer location = get_location();
- out_state.putInt("location", location);
- }
- public Integer get_location() {
- return current_menu;
- }
- public void gotoHome(View v) {
- current_menu = 0;
- setContentView(R.layout.main_menu);
- }
- public void gotoMechanics(View v) {
- current_menu = 1;
- setContentView(R.layout.mechanics_menu);
- }
- public void gotoStatistics(View v) {
- current_menu = 2;
- setContentView(R.layout.statistics_menu);
- }
- public void gotoCoordinateGeo(View v) {
- current_menu = 3;
- setContentView(R.layout.coordinate_geo);
- }
- public void gotoTrig(View v) {
- current_menu = 4;
- setContentView(R.layout.trigonometry);
- }
- public void gotoLogs(View v) {
- current_menu = 5;
- setContentView(R.layout.logs);
- }
- }
Add Comment
Please, Sign In to add comment