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
| * Go to method start * | |
| CTRL + SHIFT + UP/DOWN | |
| * GO to last viewed/cursor point * | |
| ALT + LEFT/RIGHT |
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
| // request scan | |
| Intent scanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); | |
| scanIntent.setData(Uri.fromFile(fileToDelete)); | |
| sendBroadcast(scanIntent); |
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
| import java.io.File; | |
| import java.util.ArrayList; | |
| import java.util.List; | |
| import java.util.Stack; | |
| import android.os.FileObserver; | |
| public class RecursiveFileObserver extends FileObserver { | |
| public static int CHANGES_ONLY = CLOSE_WRITE | MOVE_SELF | MOVED_FROM; | |
| List<SingleFileObserver> mObservers; | |
| String mPath; |
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 void copydb() { | |
| try { | |
| File sd = Environment.getExternalStorageDirectory(); | |
| File data = Environment.getDataDirectory(); | |
| if (sd.canWrite()) { | |
| String currentDBPath = "//data//abc.cde.package//databases//DatabaseName"; | |
| String backupDBPath = "database.db"; | |
| File currentDB = new File(data, currentDBPath); | |
| File backupDB = new File(sd, backupDBPath); |