android-sdcard

Android: Display Image from SD CARD

只谈情不闲聊 提交于 2019-11-26 06:43:50
问题 This is driving me insane! Here\'s my code (I know this file exists): File imageFile = new File(\"/sdcard/gallery_photo_4.jpg\"); ImageView jpgView = (ImageView)findViewById(R.id.imageView); BitmapDrawable d = new BitmapDrawable(getResources(), imageFile.getAbsolutePath()); jpgView.setImageDrawable(d); The error occurs on that last line (line 28, referenced below). Error output: W/dalvikvm( 865): threadid=1: thread exiting with uncaught exception (group=0x4001d800) E/AndroidRuntime( 865):

Displaying images from a specific folder on the SDCard using a gridview

柔情痞子 提交于 2019-11-26 06:38:37
问题 I\'m attempting to create a gridview that is loaded with images from a specific folder that resides on an SDCard. The path to the folder is known, (\"/sdcard/pictures\") , but in the examples I\'ve seen online I am unsure how or where to specify the path to the pictures folder I want to load images from. I have read through dozens of tutorials, even the HelloGridView tutorial at developer.android.com but those tutorials do not teach me what i am seeking. Every tutorial I have read so far has

Android Open External Storage directory(sdcard) for storing file

给你一囗甜甜゛ 提交于 2019-11-26 06:05:35
问题 I want to open external storage directory path for saving file programatically.I tried but not getting sdcard path. How can i do this?is there any solution for this?? private File path = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) + \"\"); or private File path = new File(Environment.getExternalStorageDirectory() + \"\"); I tried getting path from above both methods but both are pointing internal memory. When we open storage memory if sdcard is

How to tell if the sdcard is mounted in Android?

耗尽温柔 提交于 2019-11-26 04:47:09
问题 I\'m working on an Android application that needs to look at what images a user has stored. The problem is that if the user has the sdcard mounted via the USB cable, I can\'t read the list of images on the disk. Does anyone know of a way to tell if the usb is mounted so that I could just pop up a message informing the user that it won\'t work? 回答1: If you're trying to access images on the device, the best method is to use the MediaStore content provider. Accessing it as a content provider

Universal way to write to external SD card on Android

橙三吉。 提交于 2019-11-26 04:32:05
问题 In my application, I need to store lots of images in the device storage. Such files tend to fulfill the device storage, and I want to allow users to be able to choose external SD card as the destination folder. I read everywhere that Android doesn\'t allow users to write to external SD card, by SD card I mean the external and mountable SD card and not the external storage , but file manager applications manage to write to External SD on all Android versions. What is the better way to grant

How do I transfer an image from its URL to the SD card?

僤鯓⒐⒋嵵緔 提交于 2019-11-26 04:21:15
问题 How can I save an images to the SD card that I retrieve from the image\'s URL? 回答1: First you must make sure your application has permission to write to the sdcard. To do this you need to add the uses permission write external storage in your applications manifest file. See Setting Android Permissions Then you can you can download the URL to a file on the sdcard. A simple way is: URL url = new URL ("file://some/path/anImage.png"); InputStream input = url.openStream(); try { //The sdcard

reading a specific file from sdcard in android

ⅰ亾dé卋堺 提交于 2019-11-26 03:57:00
问题 how to read a specific file from sdcard. i have pushed the file in sdcard through DDMS and i am trying to read it though this way but this give me exception. can anybody tell me how to point exactly on that file? my code is this. String path = Environment.getExternalStorageDirectory().getAbsolutePath(); FileInputStream iStream = new FileInputStream(path); 回答1: You are trying to read a directory... what you need is the file! Do something like this... then, you can read the file as you want.

Reading an image file into bitmap from sdcard, why am I getting a NullPointerException?

时光怂恿深爱的人放手 提交于 2019-11-26 03:07:30
问题 How can I read an image file into bitmap from sdcard? _path = Environment.getExternalStorageDirectory().getAbsolutePath(); System.out.println(\"pathhhhhhhhhhhhhhhhhhhh1111111112222222 \" + _path); _path= _path + \"/\" + \"flower2.jpg\"; System.out.println(\"pathhhhhhhhhhhhhhhhhhhh111111111 \" + _path); Bitmap bitmap = BitmapFactory.decodeFile(_path, options ); I am getting a NullPointerException for bitmap. It means that the bitmap is null. But I have an image \".jpg\" file stored in sdcard

Solution to INSTALL_FAILED_INSUFFICIENT_STORAGE error on Android [closed]

穿精又带淫゛_ 提交于 2019-11-26 02:29:33
The INSTALL_FAILED_INSUFFICIENT_STORAGE error is the bane of every Android developer's life. It happens regardless of app size, or how much storage is available. Rebooting the target device fixes the problem briefly, but it soon comes back. There are hundreds (if not thousands) of message board posts from people asking why the problem occurs, but the folks at Google are frustratingly silent on the issue. There is a simple workaround. If your test device is running Android 2.2 or later then add the android:installLocation attribute to your application's manifest file, with the value

Android: How to open a specific folder via Intent and show its content in a file browser?

邮差的信 提交于 2019-11-26 02:08:26
问题 I thought this would be easy but as it turns out unfortunately it\'s not. What I have: I have a folder called \"myFolder\" on my external storage (not sd card because it\'s a Nexus 4, but that should not be the problem). The folder contains some *.csv files. What I want: I want to write a method which does the following: Show a variety of apps (file browsers) from which I can pick one (see picture). After I click on it, the selected file browser should start and show me the content of \