I am trying to create a “hint” dialog box that informs the user about enabling GPS on their phone will decrease battery life. I want it to pop-up but have a check box that says: “Do not ask me again”.
How do I go about creating this in Android?
Thank you,
Zukky.
AlertDialog.Builder prompt = new AlertDialog.Builder(this);
prompt.setCancelable(false);
prompt.setTitle("Warning");
prompt.setMessage ("HINT: Otherwise, it will use network to find" +
"your location. It's inaccurate but saves on " +
"battery! Switch GPS on for better accuracy " +
"but remember it uses more battery!");
EDIT: Beware! Code duplication ahead. Since I’m no longer developing for Android, I can’t refactor the code below.
It sets a value in Android Preferences and checks it to whether it will show the dialog or not.
checkbox.xml in resources/layouts
Activity.java