File tree 3 files changed +21
-0
lines changed
src/com/noshufou/android/su
3 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 6
6
import android .graphics .Color ;
7
7
import android .os .Bundle ;
8
8
import android .view .LayoutInflater ;
9
+ import android .view .Menu ;
10
+ import android .view .MenuItem ;
9
11
import android .view .View ;
10
12
import android .view .ViewGroup ;
11
13
import android .widget .AbsListView ;
22
24
23
25
public class LogActivity extends ListActivity {
24
26
// private static final String TAG = "Su.LogActivity";
27
+
28
+ private static final int MENU_CLEAR_LOG = 1 ;
25
29
26
30
private DBHelper mDB ;
27
31
private Cursor mCursor ;
@@ -56,6 +60,23 @@ public void onDestroy() {
56
60
super .onDestroy ();
57
61
}
58
62
63
+ @ Override
64
+ public boolean onCreateOptionsMenu (Menu menu ) {
65
+ menu .add (Menu .NONE , MENU_CLEAR_LOG , Menu .NONE , R .string .pref_clear_log )
66
+ .setIcon (R .drawable .ic_menu_clear );
67
+ return true ;
68
+ }
69
+
70
+ @ Override
71
+ public boolean onOptionsItemSelected (MenuItem item ) {
72
+ if (item .getItemId () == MENU_CLEAR_LOG ) {
73
+ mDB .clearLog ();
74
+ refreshList ();
75
+ return true ;
76
+ }
77
+ return false ;
78
+ }
79
+
59
80
private void setupListView () {
60
81
final ListView list = getListView ();
61
82
final LayoutInflater inflater = getLayoutInflater ();
You can’t perform that action at this time.
0 commit comments