CS185c
Chris Pollett
Sep. 23, 2009
<application android:icon="@drawable/two_shoes" android:label="@string/app_name" android:debuggable="true">
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if(getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { setContentView(R.layout.main_portrait); } else { setContentView(R.layout.main_landscape); } //other code of onCreate }
Log.i("Hw1", "Main ViewCreated");
SharedPreferences myPref = getSharedPreferences("MY_APP_PREFS", Context.MODE_WORLD_WRITEABLE + Context.MODE_WORLD_READABLE); Log.i("My_Activity", "Old Some_Key" + myPref.getString("Some_Key","Key did not exist") ); //second arg is returned if key did not exist Editor myPrefEditor = myPref.edit(); myPrefEditor.putString("Some_Key", "Some Value"); myPrefEditor.commit();