if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } }
@Override public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; }
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } @Override protected void onStart() { super.onStart(); //displaySera(); //displayPace(); } public void sendSera(View v) { Intent intent = new Intent(MainActivity.this, TestActivity.class); startActivityForResult(intent, 1); //startActivity(intent); }
public void sendPace(View v) { Intent intent = new Intent(MainActivity.this, TestActivity.class); startActivityForResult(intent, 2); //startActivity(intent); }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent intent) { // TODO Auto-generated method stub switch (resultCode) { case 100: displaySera(); break; case 200: displayPace(); break; default: break; } }