android-file

How to access files in Emulator SD Card using File Explorer?

允我心安 提交于 2019-12-08 11:59:02
问题 I have written a file "myData.txt" to the emulator SD card, and I can find it in mnt/sdcard/download using file explorer. Is there a way to check if I have written correctly to the file without reading it again in my Android program? How about images? What can I do to view the images written in an SD card? 回答1: If you're using Eclipse with ADT : In DDMS, on the "File Explorer" tab, there is a toolbar. There are 2 buttons on the left: arrow with disk (pull from device), and arrow with phone

Pulling hidden files in Android SD Card

我的未来我决定 提交于 2019-12-08 11:50:23
问题 I am trying to implement image caching system in android, the caching use both, caching in memory and also using android external storage . In the external storage I create some hidden files, for example .nomedia and any other file prefixed with . , and I put all my caching related files in one folder, the problem is, when I use android file explorer in ddms to pull all files in my folder, only the non hidden files are pulled , I even can't see the hidden files in ddms file explorer. So is

Can't delete file in Android

雨燕双飞 提交于 2019-12-08 11:00:12
问题 I wish delete music file stored on my phone (has no SD card) in Music folder. I have file path and File.exists() said true. Next, File.delete() also said true, but file stay in its place. But! After "deletion" I can no longer play this file, edit name and also can't copy it. But I can delete it manually. I've set android.permission.WRITE_EXTERNAL_STORAGE . OS 4.4.4 GPE Where is my mistake? Any suggestions, thanks. File file = new File(Path); if (file.exists()){ file.setWritable(true, false);

Problem in creating spreadsheet(xls) file

怎甘沉沦 提交于 2019-12-08 09:31:24
问题 I am creating an .xls -file using following code. i have got reference from http://www.vogella.de/articles/JavaExcel/article.html and http://www.andykhan.com/jexcelapi/tutorial.html Please suggest solution or alternate way to do this. below is the code String filename = "SpreadsheetTest.xls"; File root = Environment.getExternalStorageDirectory(); WorkbookSettings wbSettings = new WorkbookSettings(); wbSettings.setLocale(new Locale("en", "EN")); WritableWorkbook workbook = Workbook

Android failed to mkdir() on SD card

守給你的承諾、 提交于 2019-12-08 07:27:12
问题 I have some code to create/get a folder on SD card: if( hasSDCard() ){ UUID uniqueFileName = UUID.randomUUID(); mediaStorageDir = new File( getExternalImageStoragePath(), "MyApp"); if ( ! mediaStorageDir.exists() ){ if( ! mediaStorageDir.mkdirs() ){ MyLogger.Error("Create image directory FAILED. path: " + mediaStorageDir.getPath()); return null; } } and I have the permission registered in my Manifest file: <uses-permission android:name="android.permission.WRITE_EXTERNAL_STOREAGE"/> <uses

Playing media from internal storage directory I created

删除回忆录丶 提交于 2019-12-08 06:22:27
问题 So I created a directory on the internal storage like so: File mediadir = getDir("tvr", Context.MODE_PRIVATE); Then I download files from a server and save them inside the directory like this: URL url = new URL(urlString); URLConnection conexion = url.openConnection(); conexion.connect(); int lenghtOfFile = conexion.getContentLength(); InputStream is = url.openStream(); Log.d("DOWNLOAD NAME",name); FileOutputStream fos = new FileOutputStream(mediadir+name); etc Then files are saved

Android: Permission denied when creating a new file in external storage

梦想与她 提交于 2019-12-08 04:09:33
问题 I am trying to write a file to the external storage location on Android. Here is my code : String state = Environment.getExternalStorageState(); if(Environment.MEDIA_MOUNTED.equals(state)) { saveState= true; File pPath= Environment.getExternalStorageDirectory(); if(!pPath.exists()) { boolean bReturn= pPath.mkdirs(); Log.d(TAG, "mkdirs returned: " + bReturn); } try { File pFile= new File(pPath, "output.pcm"); pFile.createNewFile(); outputLocation= pFile.getAbsolutePath().toString(); } catch

How to show preview of file and open up file in its application in Android?

孤街醉人 提交于 2019-12-07 05:28:34
问题 I have a option to attach files within a application. I this I need to show users a preview or a icon for specific item type. Icons with extension .txt, .doc, .pdf, .jpeg, .mp4 need to have its own specific icons or if possible a good preview thumbnail icon. And when the user wants to view it he would be clicking on the icon or preview. I need to start a intent to view the file. I mean a pdf should open up in a pdf reader, or a txt or doc should open in text reader, a mp3 or mp4 should open

Downloaded files get deleted automatically

橙三吉。 提交于 2019-12-07 00:50:23
问题 In my app, there are a few files that users can download. The files get downloaded via the android download manager . But, since a few weeks now, hundreds of users have been complaining that their files automatically keep deleting every 8-12 days, without them even uninstalling the app. (There might be many more users who haven't bothered to complain about the same.) Now, there could be a number of user-specific reasons why that would happen on a few devices. But considering the huge number

startActivityForResult not working in Android version 4.4 ( Kitkat version )

拜拜、爱过 提交于 2019-12-06 16:08:06
Through my application the user can choose a file from the filemanager and process the choosen file ( Example: A PDF document ) for other steps like printing or to email. To do this I used the below code to display the intent, from which the user can choose a file from file-manager option. protected void showFileChooser(String title, String type) { Log.i(TAG, "FileChooserActivity showFileChooser(title,type)"); if (TextUtils.isEmpty(title)) title = getString(R.string.select_file); if (TextUtils.isEmpty(type)) type = "*/*"; // Implicitly allow the user to select a particular kind of data final