sd-card

ListActivity, custom row layout with Bitmap, NOT populating correctly

元气小坏坏 提交于 2019-12-13 12:44:32
问题 here is a code snippet of my ListActivity with an adapter that is attempting to a) get a list of the file paths of all files in a particular SD card directory b) factory.decode those files to bitmaps and add them to the custom row in listActivity File directory = new File("/sdcard/DirectoryOfStuff"); String[] filePaths= directory.list; ArrayAdapter<Bitmap> pics = new ArrayAdapter<Bitmap>(); for(int i = 0; i<filePaths.length; i++){ Bitmap b = BitmapFactory.decodeFile(filePaths[i]); pics.add(b)

Android: Write a xml on SD-Card

前提是你 提交于 2019-12-13 12:33:46
问题 I have a problem with my android-app. I want to save a Data-list in a xml and save it to SD-Card . Here the code fragment from my activity: Button btnActivity = (Button)findViewById(R.id.modul_save); btnActivity.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Handlerlist templist=new Handlerlist(); //default-constructor for handlerlist Parser_Writer temp_parser=new Parser_Writer(); //default-constructor for praser(writing) templist.add_modul(name, abk,

Mount/Unmount SDcard, or Simulate it - Android

为君一笑 提交于 2019-12-13 06:42:01
问题 Edit: The default media player for Android phones scans the sdcard for song files and then allows the user to play these songs based on what it has scanned. My app that I have made writes additional song files to the sdcard, but the default media player does not see these songs because it only scans for song files when it is either A: Rebooted (phone turns on). or B: when the phone's sdcard is mounted . My problem is that I need to either programatically unmount/mount the sdcard, or simulate

Cannot open image file stored in sdcard

徘徊边缘 提交于 2019-12-13 04:14:27
问题 In my application I save the contents of a tableLayout as an image in a folder. To allow user to open a file from the saved images I've created a text file that contains the names of these files. These file names will be loaded in an array (files) later. User clicks on "open" to see a list of file names and selects the one he wants to open. I'm using the following code to open a file. final String imageInSD = extStorageDirectory+"/myFolder/"+files[which]; //where 'files' is an array of

How to copy the sample images from the drawable folder to the sdcard folder, programmaticaly?

好久不见. 提交于 2019-12-13 03:58:01
问题 I have pictures/images in my drawable folder and I want to copy all of it in my sdcard folder with that same quality and details? If I have for example this. Integer[] mThumbIds = { R.drawable.pic_1, R.drawable.pic_2, R.drawable.pic_3, R.drawable.pic_4, R.drawable.pic_5, R.drawable.pic_6, R.drawable.pic_7 }; And then my app creates an own directory in sdcard, like this: String newFolder = "/myFolder2"; String extStorageDirectory = Environment.getExternalStorageDirectory().toString(); File

Showing user a particular folder in sd card and allow to select file [closed]

依然范特西╮ 提交于 2019-12-13 03:49:28
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . In my game, I save files(.xml) to a folder in sd card when user save a particular mode. Now while loading saved files, I need to show user all saved files. I want to show them as you do while selecting images from gallery as below Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent

android download image to sd-card and then read it from sd-card

血红的双手。 提交于 2019-12-13 03:49:15
问题 Merged with android download image and then read it from sd-card using sqlite. hi to all i have this problem with my code and i tried every thing that i know of and i posted it on some forums and didnt get an answer im new to android and im still learning ..... my question is that i have a code that is suppose to receive a variable that contains a website that has an image so this variable changes every time i send a new link this code should go online and download the image and save it to

Check blackberry is connected via USB

北城余情 提交于 2019-12-12 20:13:58
问题 I am doing an application which access the SD/Media card to display its images. But when device is connected via USB I cant access the media card. If thats the case, I want to show a message to user asking him to disconnect device form computer. How can I programatically check that SDCard is accessible or not ? How can I check whether the device is connected to computer via USB? Thanks. 回答1: I am not sure about your second question about checking whether the device filesystem is mounted via

Is installed package can be move to SDCard

荒凉一梦 提交于 2019-12-12 17:11:52
问题 I got a list of installed packages, how can I find out which one can be move to sdcard? List<PackageInfo> list = pm.getInstalledPackages(0); for (int i = 0; i < list.size(); i++) { } if (_pm != null) { List<PackageInfo> list = _pm.getInstalledPackages(0); for (int i = 0; i < list.size(); i++) { PackageInfo current = list.get(i); long pkgSize = new File(current.applicationInfo.sourceDir).length(); String pkgName = current.packageName; String appName = current.applicationInfo.loadLabel(_pm)

Android Mediaplayer: setDataSource issue for downloaded media file

橙三吉。 提交于 2019-12-12 10:30:49
问题 I have an application that will record and play audio files. Some of the audio files are downloaded using simple standard http downloads using httpclient. It worked like a charm for a long time. Now all of a sudden I cannot play the files I download. It fails with this stack. I store the files on the SDCard and I experience the problem both on a handset and a USB connected device. I have checked that the downloaded file is cool on the server, and I can play it without any issues. These are