--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:id="@+id/quit"
+ android:icon="@android:drawable/ic_menu_close_clear_cancel"
+ android:title="@string/quit" />
+ <item android:id="@+id/settings"
+ android:icon="@android:drawable/ic_menu_preferences"
+ android:title="@string/settings" />
+</menu>
<string name="failure">Неудача</string>
<string name="lasttry">Последнее обновление</string>
<string name="failtry">Неудачная попытка</string>
+ <string name="quit">Выход</string>
+ <string name="settings">Конфигурация</string>
<string-array name="month">
<item>января</item>
<item>февраля</item>
import android.text.format.Time;
import android.util.Log;
import android.view.View;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;
boolean wifion = wifiman.setWifiEnabled(false);
Log.w("WhereAmI", "disabling wifi result " + wifion);
}
+
+ /** Called when the menu is activated. */
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.main_menu, menu);
+ return true;
+ }
+
+ /** Called when the menu item is selected */
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.quit:
+ finish();
+ return true;
+ case R.id.settings:
+ Log.w("WhereAmI", "settings requested");
+ return true;
+ default:
+ return super.onOptionsItemSelected(item);
+ }
+ }
}