android-sdcard

SQLite database on SD card

本秂侑毒 提交于 2019-11-27 13:18:46
I'm looking to create a sqlite database on the sd card (don't want to use up the user's internal storage). I'm familiar with the OpenHelper pattern: public DatabaseFoo(Context context) { OpenHelper openHelper = new OpenHelper(context); mDb = openHelper.getWritableDatabase(); } private static class OpenHelper extends SQLiteOpenHelper { public OpenHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } ... so if we want to create on the sd card, I think instead we have to use: public static SQLiteDatabase openOrCreateDatabase (String path, SQLiteDatabase.CursorFactory

Do ALL android devices have an internal SD card?

独自空忆成欢 提交于 2019-11-27 13:09:09
问题 On the first run of my app, I am downloading a pretty big file to /sdcard/ I already know this can fail if the internal SD card of the user's phone is full or not mounted (e.g. if the phone is connected to a PC as a mass storage device, or has not been properly disconnected from a PC). But are there any android devices with NO INTERNAL SD CARD ? (on which my app would definitely be unusable) 回答1: But are there any android devices with NO INTERNAL SD CARD ? (on which my app would definitely be

MediaStore.Images.Media.insertImage is returning null when trying to save the image

天涯浪子 提交于 2019-11-27 12:58:19
问题 I am using an custom view and in that i am using an canvas in which a user can draw anything and after that i want to save that image in sd card bt was not able to do that. Don't know what is going on. else if(view.getId()==R.id.save_btn){ //save drawing AlertDialog.Builder saveDialog = new AlertDialog.Builder(this); saveDialog.setTitle("Save drawing"); saveDialog.setMessage("Save drawing to device Gallery?"); saveDialog.setPositiveButton("Yes", new DialogInterface.OnClickListener(){ private

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

大憨熊 提交于 2019-11-27 12:19:59
I want to save a json file with all the application data (something similar to preference) but im not sure what is the limit size, because if the app cant use this file it will not function probably. is this information known beforehand and the OS reserve some space for your app or its based on the size available. Update: I dont really care about External storage since is not always available in the device and could be changed (SD card) and i could check for internal storage using this but this is not what i want to know, What i want to know if there's a memory size allocated for internal

How to make a file hidden in android sd card?

社会主义新天地 提交于 2019-11-27 09:41:36
I am creating android application which contains DB that needs to be hidden(not able to access by the user)in the SD Card. Can anyone tell me how to do this? Any file stored on the SD card is accessible both by applications running on the phone, and by users who have mounted the SD card (both while it's in the phone and otherwise). You can change the file properties to make it 'hidden', but it will still be easily found. There is no way to make a file on a public partition like an SD Card 'secure' in the manner you describe - users will always be able to copy, delete, and potentially change

image attachment to a mail.. how in android?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 09:36:29
i can pick a image and its path using intent. with the use of that path of an image. i have to set that image as attachment of the mail's body content. how its possible 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));

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

让人想犯罪 __ 提交于 2019-11-27 09:15:12
问题 I have a folder in my SD Card as: /mnt/sdcard/Folder1/Folder2/Folder3/*.jpg The name of Folder1 and Folder2 remains constant and inside Folder2 i have Folder3, 4, 5 and so on.. i want to pull all the jpeg files rather all files (there are more) using adb to my current directory on the computer.. Every folder has different number of jpeg files and other files and i tried using this: adb pull mnt/sdcard/Folder1/Folder2/Folder/*.jpg . But it didnt work.. So uhmm how do i adb pull all files

Saving files on external storage on Nexus 7 and retrieving from PC

梦想与她 提交于 2019-11-27 07:10:37
问题 For my project I want to be able to save sensor data to a file, and be able to access it from a PC for further analysis. This is the code I have so far and it works successfully: File root = Environment.getExternalStorageDirectory(); File csvfile = new File(root, "Sensor_Data.csv"); FileWriter writer = new FileWriter(csvfile, true); writer.append("Time"); writer.append(','); writer.append("Position"); writer.append('\n'); Number data[] = new Number[4000]; for (int i = 0; i<4000; i+=2){

How to delete entire contents of sdcard programmatically in Android 2.2

二次信任 提交于 2019-11-27 06:25:30
问题 I wish to delete the users entire SDcard programmatically in Android 2.2. What is the easiest way to do this? Will it require root rights? Can I just do an "rm -rf /mnt/sdcard" or do I have to make a recursive loop? 回答1: You can delete directories with Java. You have to do it recursively if they are not empty: http://www.exampledepot.com/egs/java.io/DeleteDir.html No. All applications have full RW access to external storage. Yes you can execute shell commands (but you'll have to check if "rm"

How can I display image in Android Application

非 Y 不嫁゛ 提交于 2019-11-27 05:52:54
问题 I want to display Image in my Android application in specific size. How can I do it? Please guide me? And one more thing I want that image from SD card. So please Help me. Thanks in advance. 回答1: First you need to create an imageview. ImageView imageView = new ImageView(getApplicationContext()); Create layout param to add imageview on layout LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); Then get your image path String path = Environment