Advertisement
Guest User

main

a guest
Dec 17th, 2014
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.35 KB | None | 0 0
  1. package com.example.hooah.sunshine;
  2.  
  3. import android.os.Bundle;
  4. import android.support.v7.app.ActionBarActivity;
  5. import android.view.Menu;
  6. import android.view.MenuItem;
  7.  
  8.  
  9. public class MainActivity extends ActionBarActivity {
  10.  
  11.     @Override
  12.     protected void onCreate(Bundle savedInstanceState) {
  13.         super.onCreate(savedInstanceState);
  14.         setContentView(R.layout.activity_main);
  15.         if (savedInstanceState == null) {
  16.             getSupportFragmentManager().beginTransaction()
  17.                     .add(R.id.container, new ForecastFragment())
  18.                     .commit();
  19.         }
  20.     }
  21.  
  22.  
  23.     @Override
  24.     public boolean onCreateOptionsMenu(Menu menu) {
  25.         // Inflate the menu; this adds items to the action bar if it is present.
  26.         getMenuInflater().inflate(R.menu.menu_main, menu);
  27.         return true;
  28.     }
  29.  
  30.     @Override
  31.     public boolean onOptionsItemSelected(MenuItem item) {
  32.         // Handle action bar item clicks here. The action bar will
  33.         // automatically handle clicks on the Home/Up button, so long
  34.         // as you specify a parent activity in AndroidManifest.xml.
  35.         int id = item.getItemId();
  36.  
  37.         //noinspection SimplifiableIfStatement
  38.         if (id == R.id.action_settings) {
  39.             return true;
  40.         }
  41.  
  42.         return super.onOptionsItemSelected(item);
  43.     }
  44.  
  45.  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement