SQLite database on SD card

I haven’t tried to do what you describe there, but presumably it could be done and might work — with a few caveats. First, the external storage (SD card) is not secure, so any other application, or the user, could read/write to it. Second, as you noted, when it’s unmounted the DB goes away. Because … Read more

How to get the internal and external sdcard path in android

How to get the internal and external sdcard path in android Methods to store in Internal Storage: File getDir (String name, int mode) File getFilesDir () Above methods are present in Context class Methods to store in phone’s internal memory: File getExternalStorageDirectory () File getExternalFilesDir (String type) File getExternalStoragePublicDirectory (String type) In the beginning, everyone … Read more

How do I adb pull ALL files of a folder present in SD Card

Single File/Folder using pull: adb pull “/sdcard/Folder1” Output: adb pull “/sdcard/Folder1” pull: building file list… pull: /sdcard/Folder1/image1.jpg -> ./image1.jpg pull: /sdcard/Folder1/image2.jpg -> ./image2.jpg pull: /sdcard/Folder1/image3.jpg -> ./image3.jpg 3 files pulled. 0 files skipped. Specific Files/Folders using find from BusyBox: adb shell find “/sdcard/Folder1” -iname “*.jpg” | tr -d ‘\015’ | while read line; do adb … Read more

image attachment to a mail.. how in android?

Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,getResources().getString(R.string.emlSendToFriendSubject)); emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,new String[]{emailto}); emailIntent.setType(“text/plain”); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,getResources().getString(R.string.emlSendToFriendBody)); File file = getFileStreamPath(EMAIL_TEMP_FILE); emailIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); emailIntent.setType(“image/jpeg”); emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(“file://”+file.getAbsolutePath())); startActivityForResult(Intent.createChooser(emailIntent, getResources().getString(R.string.btnSendToFriend)),ActMain.EMAIL_DONE);

is there a maximum size to android internal storage allocated for an app?

If you use Environment.getExternalStorageDirectory() (or Context.getExternalFilesDir() for API level 8 and up) as the place for your json file, then I believe the size will be limited by the available space in the external storage (usually an SD card). For most devices, I believe there are no fixed limits built into Android for external file … Read more

Check if the SDCard is present, boolean is always true

I’ve found that phones, like the Galaxy phones from Samsung, have /mnt/sdcard point to internal memory and not the external SD card as expected. You can know if the path returned by Environment.getExternalStorageDirectory() is actually the external SD card with a call to Environment.isExternalStorageRemovable() Just wanted to add from the docs for getExternalStorageDirectory() this important … Read more

Android – Save images in an specific folder

Go through the following code , its working fine for me. private void createDirectoryAndSaveFile(Bitmap imageToSave, String fileName) { File direct = new File(Environment.getExternalStorageDirectory() + “/DirName”); if (!direct.exists()) { File wallpaperDirectory = new File(“/sdcard/DirName/”); wallpaperDirectory.mkdirs(); } File file = new File(“/sdcard/DirName/”, fileName); if (file.exists()) { file.delete(); } try { FileOutputStream out = new FileOutputStream(file); imageToSave.compress(Bitmap.CompressFormat.JPEG, 100, … Read more

Android: Display Image from SD CARD

I would rather use a BitmapFactory to decode the Image from the file-path: Bitmap bitmap = BitmapFactory.decodeFile(imageFile.getAbsolutePath()); jpgView.setImageBitmap(bitmap); The Docs say: If the specified file name is null, or cannot be decoded into a bitmap, the function returns null. Can you check if the code works with another image and if you can open your … Read more