1 package uk
.me
.njae
.sunshine
;
3 import android
.content
.Intent
;
4 import android
.os
.Bundle
;
5 import android
.support
.v7
.app
.ActionBarActivity
;
6 import android
.view
.Menu
;
7 import android
.view
.MenuItem
;
10 public class MainActivity
extends ActionBarActivity
{
13 protected void onCreate(Bundle savedInstanceState
) {
14 super.onCreate(savedInstanceState
);
15 setContentView(R
.layout
.activity_main
);
16 if (savedInstanceState
== null) {
17 getSupportFragmentManager().beginTransaction()
18 .add(R
.id
.container
, new ForecastFragment())
25 public boolean onCreateOptionsMenu(Menu menu
) {
26 // Inflate the menu; this adds items to the action bar if it is present.
27 getMenuInflater().inflate(R
.menu
.main
, menu
);
32 public boolean onOptionsItemSelected(MenuItem item
) {
33 // Handle action bar item clicks here. The action bar will
34 // automatically handle clicks on the Home/Up button, so long
35 // as you specify a parent activity in AndroidManifest.xml.
36 int id
= item
.getItemId();
37 if (id
== R
.id
.action_settings
) {
38 startActivity(new Intent(this, SettingsActivity
.class));
40 return super.onOptionsItemSelected(item
);