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
| // Originally appeared in https://android-developers.googleblog.com/2017/03/getting-santa-tracker-into-shape.html | |
| // Naive way to load bitmap | |
| private LruCache<Integer, Drawable> mMemoryCache; | |
| private BitmapFactory.Options mOptions; | |
| public void init() { | |
| // Initialize the cache | |
| mMemoryCache = new LruCache<Integer, Drawable>(240); | |
| // Start with no Bitmap sampling | |
| mOptions = new BitmapFactory.Options(); |
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
| // Usage: | |
| // blacklist | |
| String[] blacklist = new String[]{"com.any.package", "net.other.package"}; | |
| // your share intent | |
| Intent intent = new Intent(Intent.ACTION_SEND); | |
| intent.setType("text/plain"); | |
| intent.putExtra(Intent.EXTRA_TEXT, "some text"); | |
| intent.putExtra(android.content.Intent.EXTRA_SUBJECT, "a subject"); | |
| // ... anything else you want to add | |
| // invoke custom chooser |
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
| public int findArray(int[] array, int[] subArray) { | |
| /** | |
| * Assuming that null argument may result in Exception. We can also return -1 | |
| * if not an exception | |
| */ | |
| if (array == null || subArray == null){ | |
| throw new IllegalArgumentException("Entered array cannot be null"); | |
| } |