Want to Access Power Button events in android [duplicate]
You should add the following permission to your manifest file: <uses-permission android:name=”android.permission.PREVENT_POWER_KEY” />
You should add the following permission to your manifest file: <uses-permission android:name=”android.permission.PREVENT_POWER_KEY” />
You need to get the radio button at that index, then get the value of the text of that button. Try this code below. if(rg1.getCheckedRadioButtonId()!=-1){ int id= rg1.getCheckedRadioButtonId(); View radioButton = rg1.findViewById(id); int radioId = radioGroup.indexOfChild(radioButton); RadioButton btn = (RadioButton) rg1.getChildAt(radioId); String selection = (String) btn.getText(); }
Here’s another solution that is very simple and doesn’t require you to worry about the finger being moved. If you are basing a click as simply the distance moved then how can you differentiate a click and a long click. You could put more smarts into this and include the distance moved, but i’m yet … Read more