android-file

Android: how to get list of all preference xml's for my app and read them?

怎甘沉沦 提交于 2019-11-30 09:36:00
how to get list of all application preferences for application, 1. I am saving shared preference in this manner 2. I know that they are in data/data/app_packagename/shared_prefs 3. THE PROBLEM: But how to get list of all preference xml files in a spinner and read each preference, i searched in SO , but i did not found any help regarding this, how to do read all preference xml files in my application directory and access the preferences? P.S: I am aware of SharedPreference.getAll(); , will be enough to read once i get the file? I have wrote in bits(Rough Code), it give error when tried to run,

Android select mp3 file

假装没事ソ 提交于 2019-11-30 05:20:54
Sorry if this has already been answered, but I can't specify my question very well. I have an activity that needs a song file from your device, and I want it when I press a button to open a dialog to ask you how you want to open a file (like to choose a file explorer) and then the user will select an mp3 file (it should be possible to enter both internal memory and external, at least those available to users, like in my Xperia V which has 2 internal partitions, and an SD Card), and when a music file is selected (.wav, .mp3, .acc files) to load its name and file path in my app. How can I do it?

How to Get Absolute Path in Android for File?

扶醉桌前 提交于 2019-11-30 04:55:22
问题 btnimport.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent fileintent = new Intent(Intent.ACTION_GET_CONTENT); fileintent.setType("*/*"); try { startActivityForResult(fileintent, requestcode); } catch (ActivityNotFoundException e) { } } });` I'm trying to import sky.csv file in my Android application. But, when I select file, I'd get: IO Exception : open failed: ENOENT (No such file or directory) I will check path in: LOG > content://com.android

how to create a file with world readable permission under subdirectory of files directory

被刻印的时光 ゝ 提交于 2019-11-30 04:52:41
I need to create files under myapp/files/subdir with global permission in my application. I do this because I use external applications to open some files Using this FileOutputStream fos = openFileOutput(FILENAME, Context.MODE_WORLD_READABLE); creates file only under files folder. Using File dir=new File(Constants.TASK_DIRECTORY); dir.mkdirs(); File file=new File(dir, FILENAME); file.createNewFile(); FileOutputStream fos=new FileOutputStream(file); creates files under subdirectories but with private permissions. I need to find a way to compose those both to create a file in a subdirectory to

Load a file from external storage to Inputstream

时光怂恿深爱的人放手 提交于 2019-11-30 01:22:58
i have a video file in my external directory. how can i load it to inputstream variable. For the time being i am reading file in the res/raw folder but i want to read it from the sdcard. also i dont know about the name of the file but its path will be recieved through intent. check the following code public class SonicTest extends Activity { VideoView videoView; String uri; InputStream soundFile; File file; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } public void play(View view) { new Thread(new Runnable() {

How to capture/record clip from Video URL in Android and save to phone

谁说我不能喝 提交于 2019-11-29 18:45:28
问题 In Android, is it possible to record a short clip (ex: an arbitrary 5-10 seconds in the video) from a Video URL (ex: http://www.test.com/video.mp4)? For example, I'd like to stream a video (from url) in an Activity and allow the ability to capture/record a short clip from it. Perhaps, allow the user to record an arbitrary Start/End time from the video. If so, is there an API to accomplish this? If not, is there an Android library to support this? Please provide a sample code solution for this

Android - Copy files from assets to /data/data folder

偶尔善良 提交于 2019-11-29 04:02:25
I need to use some files in my app. They are kept in asset folder. I saw discussions on SO, where the files are being copied from asset folder, to /data/data/ on the internal storage, and then being used. I get the code, but what I do not get is, what is the need to copy the assets to internal storage ? If anybody has experience with this, help ! One reason that just popped up for me is when using existing C/C++ code with NDK that requires a path to a file and you don't want to modify that code. For example, I'm using an existing C library that needs some data files and the only existing

Android: Open file with intent chooser from URI obtained by Storage Access Framework

强颜欢笑 提交于 2019-11-29 03:37:48
In the beginning the user can select files with the new Storage Access Framework (Assuming the app is API>19): https://developer.android.com/guide/topics/providers/document-provider.html Then I save references to those chosen files by saving the URI`s which looks like: content://com.android.providers.downloads.documments/document/745 (in this case the file is from the default downloads dir`). Later, I want let the user to open those files (For example they names displayed in UI list, and the user selects one). I want to do this with the Android famous intent chooser feature, and all I have is

Android select mp3 file

柔情痞子 提交于 2019-11-29 03:37:46
问题 Sorry if this has already been answered, but I can't specify my question very well. I have an activity that needs a song file from your device, and I want it when I press a button to open a dialog to ask you how you want to open a file (like to choose a file explorer) and then the user will select an mp3 file (it should be possible to enter both internal memory and external, at least those available to users, like in my Xperia V which has 2 internal partitions, and an SD Card), and when a

How to get the internal and external sdcard path in android

末鹿安然 提交于 2019-11-29 01:21:48
Most of the new android devices have an internal sdcard and an external sdcard. I want to make a file explorer app but I can't find out how to get the path to use in my app because File file = Environment.getExternalStorageDirectory(); just returns in most device /mnt/sdcard but there is another path for the other external sdcard like /storage1 or /storage2 . Any help appreciated. AnV 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