This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private Handler handler = new Handler(); | |
| @Override | |
| protected void onCreate(Bundle savedInstanceState) { | |
| ... | |
| handler.post(runnable); | |
| } | |
| @Override | |
| protected void onPause() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private static final int PERMISSIONS_REQUEST_READ_CONTACTS = 1; | |
| private static String[] PERMISSIONS_CONTACT = {Manifest.permission.READ_CONTACTS} | |
| if (checkSelfPermission(PERMISSIONS_CONTACT)) { | |
| Log.i(TAG, | |
| "Contact permissions have already been granted. Displaying contact details."); | |
| } else { | |
| Log.i(TAG, "Contact permissions has NOT been granted. Requesting permission."); | |
| requestPermissions(PERMISSIONS_CONTACT, PERMISSIONS_REQUEST_READ_CONTACTS); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Hide the navigation bar if we are on a Gamestop tablet. | |
| mStatusBar = getSystemService("statusbar"); | |
| if (mStatusBar != null){ | |
| Log.v("statusbar", "get status bar service "+mStatusBar.getClass()); | |
| Method[] arrayOfMethods; | |
| Method localMethod; | |
| arrayOfMethods = mStatusBar.getClass().getMethods(); | |
| for (int i = 0; i < arrayOfMethods.length; i++){ | |
| localMethod = arrayOfMethods[i]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * URL encodes an array of parameters into a query string. | |
| * | |
| * @param params | |
| * @return | |
| */ | |
| private static String urlEncode(String[] params) { | |
| if (params.length % 2 != 0) { | |
| throw new IllegalArgumentException("Params must have an even number of elements."); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * URL encodes an array of parameters into a query string. | |
| * | |
| * @param params | |
| * @return | |
| */ | |
| private static String urlEncode(String[] params) { | |
| if (params.length % 2 != 0) { | |
| throw new IllegalArgumentException("Params must have an even number of elements."); | |
| } |