List of usage examples for android.content.pm PackageManager hasSystemFeature
public abstract boolean hasSystemFeature(String name);
From source file:org.hopestarter.wallet.ui.send.SweepWalletFragment.java
@Override public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) { inflater.inflate(R.menu.sweep_wallet_fragment_options, menu); reloadAction = menu.findItem(R.id.sweep_wallet_options_reload); scanAction = menu.findItem(R.id.sweep_wallet_options_scan); final PackageManager pm = activity.getPackageManager(); scanAction.setVisible(pm.hasSystemFeature(PackageManager.FEATURE_CAMERA) || pm.hasSystemFeature(PackageManager.FEATURE_CAMERA_FRONT)); super.onCreateOptionsMenu(menu, inflater); }
From source file:galilei.kelimekavanozu.activity.ThemeChooserActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Accelerometer check PackageManager manager = getPackageManager(); hasAccelerometer = manager.hasSystemFeature(PackageManager.FEATURE_SENSOR_ACCELEROMETER); setContentView(R.layout.activity_theme_chooser); SugarContext.init(this); arkaplan500 = (ImageView) findViewById(R.id.arkaplan500); kavanoz = (ImageView) findViewById(R.id.cannonball_logo); recyclerView = (RecyclerView) findViewById(R.id.main_list); final Animation shake = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.shake); fab = (FloatingActionButton) findViewById(R.id.fab); StaggeredGridLayoutManager gridLayoutManager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL); gridLayoutManager.setGapStrategy(StaggeredGridLayoutManager.GAP_HANDLING_MOVE_ITEMS_BETWEEN_SPANS); recyclerView.setLayoutManager(gridLayoutManager); initialCount = Note.count(Note.class); if (savedInstanceState != null) modifyPos = savedInstanceState.getInt("modify"); if (initialCount >= 0) { notes = Note.listAll(Note.class); adapter = new KelimelerAdapter(ThemeChooserActivity.this, notes); recyclerView.setAdapter(adapter); }/*w w w . ja v a 2 s .c o m*/ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { Drawable drawable = ContextCompat.getDrawable(this, R.drawable.ic_add_24dp); drawable = DrawableCompat.wrap(drawable); DrawableCompat.setTint(drawable, Color.WHITE); DrawableCompat.setTintMode(drawable, PorterDuff.Mode.SRC_IN); fab.setImageDrawable(drawable); } fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Crashlytics.log("Yeni Kelime: butona basld"); // Answers.getInstance().logCustom(new CustomEvent("Ekle butonuna basld")); Intent i = new Intent(ThemeChooserActivity.this, AddNoteActivity.class); startActivity(i); } }); if (isNetworkConnected()) { new arkaplan().execute(); } // Handling swipe to delete setUpViews(); ItemTouchHelper.SimpleCallback simpleCallback = new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT) { @Override public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) { return false; } @Override public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) { //Remove swiped item from list and notify the RecyclerView final int position = viewHolder.getAdapterPosition(); final Note note = notes.get(viewHolder.getAdapterPosition()); notes.remove(viewHolder.getAdapterPosition()); adapter.notifyItemRemoved(position); note.delete(); initialCount -= 1; Snackbar.make(fab, "Kelime silindi", Snackbar.LENGTH_SHORT) .setAction("GER AL", new View.OnClickListener() { @Override public void onClick(View v) { note.save(); notes.add(position, note); adapter.notifyItemInserted(position); initialCount += 1; } }).show(); } }; ItemTouchHelper itemTouchHelper = new ItemTouchHelper(simpleCallback); itemTouchHelper.attachToRecyclerView(recyclerView); adapter.SetOnItemClickListener(new KelimelerAdapter.OnItemClickListener() { @Override public void onItemClick(View view, int position) { Log.d("Main", "click"); Intent i = new Intent(ThemeChooserActivity.this, AddNoteActivity.class); i.putExtra("isEditing", true); i.putExtra("note_title", notes.get(position).title); i.putExtra("note", notes.get(position).note); i.putExtra("note_time", notes.get(position).time); modifyPos = position; startActivity(i); } }); if (hasAccelerometer) { kavanoz.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // View element to be shaken // Perform animation if (notclick) { kavanoz.startAnimation(shake); shakemode = true; notclick = false; Snackbar.make(fab, "Rastgele kelimelerden birini grmek iin telefonunuzu sallayn.", Snackbar.LENGTH_LONG).show(); kavanoz.setColorFilter(Color.argb(100, 255, 140, 0)); } else { shakemode = false; notclick = true; kavanoz.setColorFilter(getResources().getColor(R.color.green)); } } }); // ShakeDetector initialization mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); mShakeDetector = new ShakeDetector(); mShakeDetector.setOnShakeListener(new ShakeDetector.OnShakeListener() { @Override public void onShake(int count) { if (shakemode) { /* * The following method, "handleShakeEvent(count):" is a stub // * method you would use to setup whatever you want done once the * device has been shook. */ // View element to be shaken // Perform animation Crashlytics.log("Shake event : triggered"); Answers.getInstance().logCustom(new CustomEvent("Shake event : tetiklendi")); kavanoz.startAnimation(shake); new rastgeletweet().execute(); } } }); } }
From source file:com.example.android.batchstepsensor.BatchStepSensorFragment.java
/** * Returns true if this device is supported. It needs to be running Android KitKat (4.4) or * higher and has a step counter and step detector sensor. * This check is useful when an app provides an alternative implementation or different * functionality if the step sensors are not available or this code runs on a platform version * below Android KitKat. If this functionality is required, then the minSDK parameter should * be specified appropriately in the AndroidManifest. * * @return True iff the device can run this sample *///from www . ja v a 2 s . co m private boolean isKitkatWithStepSensor() { // BEGIN_INCLUDE(iskitkatsensor) // Require at least Android KitKat int currentApiVersion = android.os.Build.VERSION.SDK_INT; // Check that the device supports the step counter and detector sensors PackageManager packageManager = getActivity().getPackageManager(); return currentApiVersion >= android.os.Build.VERSION_CODES.KITKAT && packageManager.hasSystemFeature(PackageManager.FEATURE_SENSOR_STEP_COUNTER) && packageManager.hasSystemFeature(PackageManager.FEATURE_SENSOR_STEP_DETECTOR); // END_INCLUDE(iskitkatsensor) }
From source file:org.protocoderrunner.apprunner.AppRunnerActivity.java
public void initializeNFC() { if (nfcInit == false) { PackageManager pm = getPackageManager(); nfcSupported = pm.hasSystemFeature(PackageManager.FEATURE_NFC); if (nfcSupported == false) { return; }/*from w ww . j ava2 s. c o m*/ // cuando esta en foreground MLog.d(TAG, "Starting NFC"); mAdapter = NfcAdapter.getDefaultAdapter(this); /* * mAdapter.setNdefPushMessageCallback(new * NfcAdapter.CreateNdefMessageCallback() { * * @Override public NdefMessage createNdefMessage(NfcEvent event) { * // TODO Auto-generated method stub return null; } }, this, null); */ // Create mContext generic PendingIntent that will be deliver to this // activity. // The NFC stack will fill in the intent with the details of the // discovered tag before // delivering to this activity. mPendingIntent = PendingIntent.getActivity(this, 0, new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0); // Setup an intent filter for all MIME based dispatches IntentFilter ndef = new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED); try { ndef.addDataType("*/*"); } catch (IntentFilter.MalformedMimeTypeException e) { throw new RuntimeException("fail", e); } mFilters = new IntentFilter[] { ndef, }; // Setup mContext tech list for all NfcF tags mTechLists = new String[][] { new String[] { NfcF.class.getName() } }; nfcInit = true; } }
From source file:cordova.plugins.Diagnostic.java
public boolean isCameraPresent() { PackageManager pm = this.cordova.getActivity().getPackageManager(); boolean result = pm.hasSystemFeature(PackageManager.FEATURE_CAMERA); return result; }
From source file:com.mobicage.rogerthat.GroupDetailActivity.java
private void getNewAvatar(boolean checkPermission) { T.UI();//from w ww. j a va 2s. co m if (checkPermission) { final SafeRunnable continueRunnable = new SafeRunnable() { @Override protected void safeRun() throws Exception { getNewAvatar(false); } }; final SafeRunnable runnableCheckStorage = new SafeRunnable() { @Override protected void safeRun() throws Exception { if (askPermissionIfNeeded(Manifest.permission.WRITE_EXTERNAL_STORAGE, PERMISSION_REQUEST_CAMERA, continueRunnable, null)) return; continueRunnable.run(); } }; if (askPermissionIfNeeded(Manifest.permission.CAMERA, PERMISSION_REQUEST_CAMERA, runnableCheckStorage, null)) return; runnableCheckStorage.run(); return; } File image; try { image = getTmpUploadPhotoLocation(); } catch (IOException e) { L.d(e.getMessage()); UIUtils.showLongToast(getApplicationContext(), e.getMessage()); return; } image.delete(); mUriSavedImage = Uri.fromFile(image); Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, mUriSavedImage); cameraIntent.putExtra("outputFormat", Bitmap.CompressFormat.PNG.toString()); Intent galleryIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); galleryIntent.putExtra(MediaStore.EXTRA_OUTPUT, mUriSavedImage); galleryIntent.putExtra("outputFormat", Bitmap.CompressFormat.PNG.toString()); galleryIntent.setType("image/*"); PackageManager pm = getPackageManager(); final Intent chooserIntent = Intent.createChooser(galleryIntent, getString(R.string.select_source)); if (pm.hasSystemFeature(PackageManager.FEATURE_CAMERA)) { chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[] { cameraIntent }); } startActivityForResult(chooserIntent, PICK_IMAGE); }
From source file:com.example.nativeaudio.NativeAudio.java
/** Called when the activity is first created. */ @Override/*from w ww. j av a 2 s . c o m*/ @TargetApi(17) protected void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); Log.d(TAG, "onCreate ----------- "); assetManager = getAssets(); /* Ctrl+O ? Ctrl+I ? Ctrl+N /? Ctrl+Shift+N Ctrl+Shift+ALt+N ? Ctrl+Space ??? Ctrl+Shift+Space ? Ctrl+Shift+Enter (? ?; ) Ctrl+P ?? Alt+Enter ?/?/ Ctrl+J ?? ( for foreach Toast system.out.println) logm logr loge */ // initialize native audio system createEngine(); int sampleRate = 0; int bufSize = 0; /* * retrieve fast audio path sample rate and buf size; if we have it, we pass to native * side to create a player with fast audio enabled [ fast audio == low latency audio ]; * IF we do not have a fast audio path, we pass 0 for sampleRate, which will force native * side to pick up the 8Khz sample rate. */ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { AudioManager myAudioMgr = (AudioManager) getSystemService(Context.AUDIO_SERVICE); String nativeParam = myAudioMgr.getProperty(AudioManager.PROPERTY_OUTPUT_SAMPLE_RATE); sampleRate = Integer.parseInt(nativeParam); nativeParam = myAudioMgr.getProperty(AudioManager.PROPERTY_OUTPUT_FRAMES_PER_BUFFER); bufSize = Integer.parseInt(nativeParam); // buffer? PackageManager pm = getPackageManager(); boolean claimsFeature = pm.hasSystemFeature(PackageManager.FEATURE_AUDIO_LOW_LATENCY); // ?5 OUTPUT_SAMPLE_RATE = 48000 OUTPUT_FRAMES_PER_BUFFER = 192 FEATURE_AUDIO_LOW_LATENCY = false // MTK MT6735 OUTPUT_SAMPLE_RATE = 44100 OUTPUT_FRAMES_PER_BUFFER = 1024 FEATURE_AUDIO_LOW_LATENCY = false Log.d(TAG, "OUTPUT_SAMPLE_RATE = " + sampleRate + " OUTPUT_FRAMES_PER_BUFFER = " + bufSize + " FEATURE_AUDIO_LOW_LATENCY = " + claimsFeature); } // buffer queue AudioPlayer Demo createBufferQueueAudioPlayer(sampleRate, bufSize); // initialize URI spinner Spinner uriSpinner = (Spinner) findViewById(R.id.uri_spinner); ArrayAdapter<CharSequence> uriAdapter = ArrayAdapter.createFromResource(this, R.array.local_uri_spinner_array, /* R.array.uri_spinner_array, */ android.R.layout.simple_spinner_item); uriAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); uriSpinner.setAdapter(uriAdapter); uriSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) { URI = parent.getItemAtPosition(pos).toString(); /* ? ? <string-array name="uri_spinner_array"> <item>http://upload.wikimedia.org/wikipedia/commons/6/6d/Banana.ogg</item> <item>http://www.freesound.org/data/previews/18/18765_18799-lq.mp3</item> </string-array> */ } public void onNothingSelected(AdapterView parent) { URI = null; } }); // initialize button click handlers ((Button) findViewById(R.id.hello)).setOnClickListener(new OnClickListener() { public void onClick(View view) { // ignore the return value selectClip(CLIP_HELLO, 2); } }); ((Button) findViewById(R.id.android)).setOnClickListener(new OnClickListener() { public void onClick(View view) { // ignore the return value selectClip(CLIP_ANDROID, 7); } }); ((Button) findViewById(R.id.sawtooth)).setOnClickListener(new OnClickListener() { public void onClick(View view) { // ignore the return value selectClip(CLIP_SAWTOOTH, 1); } }); ((Button) findViewById(R.id.reverb)).setOnClickListener(new OnClickListener() { boolean enabled = false; public void onClick(View view) { enabled = !enabled; if (!enableReverb(enabled)) { enabled = !enabled; } } }); // AssertManager APK?mp3 // ((Button) findViewById(R.id.embedded_soundtrack)).setOnClickListener(new OnClickListener() { boolean created = false; public void onClick(View view) { if (!created) { created = createAssetAudioPlayer(assetManager, "withus.mp3"); } if (created) { // URI AudioPlayer Demo ? // URI AudioPlayer Demo ? ?play pause // Assert/fd AudioPlayer Demo ? isPlayingAsset = !isPlayingAsset; setPlayingAssetAudioPlayer(isPlayingAsset); } } }); ((Button) findViewById(R.id.uri_soundtrack)).setOnClickListener(new OnClickListener() { boolean created = false; public void onClick(View view) { if (!created && URI != null) { Log.d(TAG, " uri_soundtrack create URI Audio Player URI " + URI); //URI = "file:///mnt/sdcard/xxx.3gp" ; //URI = "file:///mnt/sdcard/Banana.ogg" ; created = createUriAudioPlayer(URI); } } }); ((Button) findViewById(R.id.pause_uri)).setOnClickListener(new OnClickListener() { public void onClick(View view) { Log.d(TAG, " setPlayingUriAudioPlayer pause URI "); setPlayingUriAudioPlayer(false); } }); ((Button) findViewById(R.id.play_uri)).setOnClickListener(new OnClickListener() { public void onClick(View view) { Log.d(TAG, " setPlayingUriAudioPlayer play URI "); setPlayingUriAudioPlayer(true); } }); ((Button) findViewById(R.id.loop_uri)).setOnClickListener(new OnClickListener() { boolean isLooping = false; public void onClick(View view) { isLooping = !isLooping; setLoopingUriAudioPlayer(isLooping); } }); ((Button) findViewById(R.id.mute_left_uri)).setOnClickListener(new OnClickListener() { boolean muted = false; public void onClick(View view) { muted = !muted; setChannelMuteUriAudioPlayer(0, muted); } }); ((Button) findViewById(R.id.mute_right_uri)).setOnClickListener(new OnClickListener() { boolean muted = false; public void onClick(View view) { muted = !muted; setChannelMuteUriAudioPlayer(1, muted); } }); ((Button) findViewById(R.id.solo_left_uri)).setOnClickListener(new OnClickListener() { boolean soloed = false; public void onClick(View view) { soloed = !soloed; setChannelSoloUriAudioPlayer(0, soloed); } }); ((Button) findViewById(R.id.solo_right_uri)).setOnClickListener(new OnClickListener() { boolean soloed = false; public void onClick(View view) { soloed = !soloed; setChannelSoloUriAudioPlayer(1, soloed); } }); ((Button) findViewById(R.id.mute_uri)).setOnClickListener(new OnClickListener() { boolean muted = false; public void onClick(View view) { muted = !muted; setMuteUriAudioPlayer(muted); } }); /* * ???? ? Stereo Panning * https://developer.android.com/ndk/guides/audio/opensl-prog-notes.html#panning * * */ ((Button) findViewById(R.id.enable_stereo_position_uri)).setOnClickListener(new OnClickListener() { boolean enabled = false; public void onClick(View view) { enabled = !enabled; enableStereoPositionUriAudioPlayer(enabled); } }); // ?? ?AudioPlayer ??? ?SetPlayState??? ((Button) findViewById(R.id.channels_uri)).setOnClickListener(new OnClickListener() { public void onClick(View view) { if (numChannelsUri == 0) { numChannelsUri = getNumChannelsUriAudioPlayer(); } Toast.makeText(NativeAudio.this, "Channels: " + numChannelsUri, Toast.LENGTH_SHORT).show(); } }); // ?? ((SeekBar) findViewById(R.id.volume_uri)).setOnSeekBarChangeListener(new OnSeekBarChangeListener() { int lastProgress = 100; public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { if (BuildConfig.DEBUG && !(progress >= 0 && progress <= 100)) { throw new AssertionError(); } lastProgress = progress; } public void onStartTrackingTouch(SeekBar seekBar) { } public void onStopTrackingTouch(SeekBar seekBar) { int attenuation = 100 - lastProgress; int millibel = attenuation * -50; // 100 * -50 ~ 0 setVolumeUriAudioPlayer(millibel); } }); ((SeekBar) findViewById(R.id.pan_uri)).setOnSeekBarChangeListener(new OnSeekBarChangeListener() { int lastProgress = 100; public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { if (BuildConfig.DEBUG && !(progress >= 0 && progress <= 100)) { throw new AssertionError(); } lastProgress = progress; } public void onStartTrackingTouch(SeekBar seekBar) { } public void onStopTrackingTouch(SeekBar seekBar) { // ?? ? // ? ? ?<50 >50 ? int permille = (lastProgress - 50) * 20; setStereoPositionUriAudioPlayer(permille); } }); ((SeekBar) findViewById(R.id.playback_rate_uri)).setOnSeekBarChangeListener(new OnSeekBarChangeListener() { int lastProgress = 100; public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { if (BuildConfig.DEBUG && !(progress >= 0 && progress <= 100)) { throw new AssertionError(); } lastProgress = progress; } public void onStartTrackingTouch(SeekBar seekBar) { } public void onStopTrackingTouch(SeekBar seekBar) { /* 0 ----- 50 ---- 100 -1000 --- 0 ---- 1000 */ int permille = lastProgress * (1000 - -1000) / 100 + (-1000); setPlaybackRateUriAudioPlayer(permille); } }); ((Button) findViewById(R.id.record)).setOnClickListener(new OnClickListener() { public void onClick(View view) { // int status = ActivityCompat.checkSelfPermission(NativeAudio.this, // Manifest.permission.RECORD_AUDIO); // if (status != PackageManager.PERMISSION_GRANTED) { // ActivityCompat.requestPermissions( // NativeAudio.this, // new String[]{Manifest.permission.RECORD_AUDIO}, // AUDIO_ECHO_REQUEST); // return; // } recordAudio(); } }); ((Button) findViewById(R.id.playback)).setOnClickListener(new OnClickListener() { public void onClick(View view) { // ignore the return value selectClip(CLIP_PLAYBACK, 3); } }); }
From source file:io.jawg.osmcontributor.ui.activities.MapActivity.java
public void toggleArpiGl() { PackageManager pm = getPackageManager(); // Switch to ArpiGl fragment if the sensors are present. IF they aren't, just display a screenshot of ArpiGl view if (pm.hasSystemFeature(PackageManager.FEATURE_SENSOR_GYROSCOPE) && pm.hasSystemFeature(PackageManager.FEATURE_SENSOR_ACCELEROMETER)) { if (arpiGlFragment.isVisible()) { getFragmentManager().beginTransaction().hide(arpiGlFragment).commit(); eventBus.post(new ChangeMapModeEvent(MapMode.DEFAULT)); } else {//from w w w . java2 s. c o m getFragmentManager().beginTransaction().show(arpiGlFragment).commit(); eventBus.post(new PleaseGiveMeMapCenterEvent()); eventBus.post(new ChangeMapModeEvent(MapMode.ARPIGL)); } } else { if (arpiScreenshot.getVisibility() == View.GONE) { arpiScreenshot.setVisibility(View.VISIBLE); eventBus.post(new ChangeMapModeEvent(MapMode.ARPIGL)); Toast.makeText(this, R.string.arpi_not_supported, Toast.LENGTH_LONG).show(); } else { arpiScreenshot.setVisibility(View.GONE); eventBus.post(new ChangeMapModeEvent(MapMode.DEFAULT)); } } }
From source file:com.p2p.misc.DeviceUtility.java
public Boolean hasCamera() { PackageManager pm = mactivity.getApplicationContext().getPackageManager(); Boolean camera = pm.hasSystemFeature(PackageManager.FEATURE_CAMERA); return camera; }
From source file:com.cw.litenote.DrawerActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { // System.out.println("DrawerActivity / onCreateOptionsMenu"); mMenu = menu;// ww w. j a va2 s . c o m // inflate menu getMenuInflater().inflate(R.menu.main_menu, menu); // check camera feature PackageManager packageManager = this.getPackageManager(); // camera image if (!packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA)) menu.findItem(R.id.ADD_NEW_IMAGE).setEnabled(false); // camera video if (!packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA)) menu.findItem(R.id.ADD_NEW_VIDEO).setEnabled(false); playOrStopMusicButton = menu.findItem(R.id.PLAY_OR_STOP_MUSIC); // show body mPref_show_note_attribute = getSharedPreferences("show_note_attribute", 0); if (mPref_show_note_attribute.getString("KEY_SHOW_BODY", "yes").equalsIgnoreCase("yes")) menu.findItem(R.id.SHOW_BODY).setIcon(R.drawable.ic_menu_collapse) .setTitle(R.string.preview_note_body_no); else menu.findItem(R.id.SHOW_BODY).setIcon(R.drawable.ic_menu_expand) .setTitle(R.string.preview_note_body_yes); // show draggable mPref_show_note_attribute = getSharedPreferences("show_note_attribute", 0); if (mPref_show_note_attribute.getString("KEY_ENABLE_DRAGGABLE", "no").equalsIgnoreCase("yes")) menu.findItem(R.id.ENABLE_NOTE_DRAG_AND_DROP).setIcon(R.drawable.ic_dragger_off) .setTitle(R.string.draggable_no); else menu.findItem(R.id.ENABLE_NOTE_DRAG_AND_DROP).setIcon(R.drawable.ic_dragger_on) .setTitle(R.string.draggable_yes); // // Group 1 sub_menu for drawer operation // // add sub_menu item: add drawer dragger setting if (mPref_show_note_attribute.getString("KEY_ENABLE_DRAWER_DRAGGABLE", "no").equalsIgnoreCase("yes")) menu.findItem(R.id.ENABLE_DRAWER_DRAG_AND_DROP).setIcon(R.drawable.ic_dragger_off) .setTitle(R.string.draggable_no); else menu.findItem(R.id.ENABLE_DRAWER_DRAG_AND_DROP).setIcon(R.drawable.ic_dragger_on) .setTitle(R.string.draggable_yes); return super.onCreateOptionsMenu(menu); }