FAQ Database Discussion Community


How to save video taken from VideoView to external SD card?

android,android-sdcard,android-file,android-videoview
I'm trying to save a video, I already successfully captured and put into my VideoView, to my SD card. Lots of research, but I found nothing simple and straightforward to help my problem. I was able to save a photo to the SD card, using very similar code (except not...

Saving files to SD card on Android Lollipop

android,android-5.0-lollipop,android-sdcard,android-file,documentfile
Android 5 introduce new API for working with SD-card. If you want to write files into some directory on the SC-card, y need get access to it. As far as I know, it could be done in this way: Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE); startActivityForResult(intent, 42); and then: public void...

Loading the pdf within the application on Android with PdfRenderer - how to locate the file?

android,android-file,pdfrenderer
I would like to use PdfRenderer to display the myDoc.pdf within the application: File file = new File("/sdcard/Download/myDoc.pdf"); PdfRenderer renderer = new PdfRenderer(ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY)); ... The problem is, I want to include the myDoc.pdf in the application rather then assuming it's under /sdcard/Download/ or on some website. How can I...

How to escape special char in filename

android,android-file
I want to load a file in my app and copy it to my app folder. But, when filename contains space or special chars, it fail. I'm using filter Here my code : Manifest <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="file" /> <data android:mimeType="*/*" /> <data android:pathPattern=".*\\.pdf" /> <data...

Android - Passing simple string over Wi-fi?

java,android,android-wifi,android-broadcast,android-file
I have Wi-fi direct demo. In that we can transfer any image files to other devices. When another device get connected and it shows to send image from gallery. And at other side it shows sent image. But I want to send a simple string and at other side I...

Implementing a File Picker in Android and replicating the selected file at another location

android,android-intent,android-file,android-fileprovider,android-implicit-intent
I'm trying to implement a File Picker in my Android project. What I've been able to do so far is : Intent chooseFile; Intent intent; chooseFile = new Intent(Intent.ACTION_GET_CONTENT); chooseFile.setType("*/*"); intent = Intent.createChooser(chooseFile, "Choose a file"); startActivityForResult(intent, PICKFILE_RESULT_CODE); And then in my onActivityResult() switch(requestCode){ case PICKFILE_RESULT_CODE: if(resultCode==-1){ Uri uri =...

Read/Write from textfile using openFileOutput

android,android-file
I'm making an app and it will use a text file to store a password. I'm currently trying to save this password to the file, it looks like it saves but I cannot know because I cannot read from the file. Straight after I attempt to save the password to...

Displaying the same image files in adapter - Android

android,android-adapter,android-gridview,android-file
Situation: I have an activity that contains an image picker function to select images. Once selected, these images are loaded/displayed in a GridView. I load the images using ImageLoader library with the following method: ImageLoader.getInstance().displayImage("file://"+image.path, Utility.displayImageOptions); In the same activity i have a Preview button which clicked lead to an...

Android File to String

java,android,inputstream,android-file,bufferedwriter
I want to read out a file in Android and get the content as a string. Then I want to send it to a server. But for testing I just create a file on the device and put the content into it: InputStream stream = getContentResolver().openInputStream(fileUri); BufferedReader reader = new...

Save arraylist of objects and reading it from file

android,android-file
I have an arraylist of objects in a fragmentActivity private List<Movie> myMovies = null; I have options to add, remove and all that from the movie list, but once I close the application all is lost. How can I save the array into a file and retrieve the array from...

Cannot resolve method 'openFileOutput(java.lang.String,int)

java,android,android-studio,android-file
A night before, I implemented a code snippet in Android studio to access a file and write a string in a file.But some how I am not able to build it sucessfully. I don't know what is wrong with "openFileOutput()" method. I have already tried adding context before openFileOutput() method,...

no such file in JSch on android

android,jsch,android-file
Im trying to upload a file from my service. Im doing this like this: JSch ssh = new JSch(); java.util.Properties config = new java.util.Properties(); config.put("StrictHostKeyChecking", "no"); session = ssh.getSession("****", "*myIP*"); session.setPassword("*******"); session.setConfig(config); session.connect(); channel = session.openChannel("sftp"); channel.connect(); ChannelSftp sftp = (ChannelSftp) channel; sftp.put(f + "/" + file, " /var/www/webimages/client/88/"); }...

Not able to share file with whitespace in name in android

android,android-intent,android-file,android-sharing
I am not able to share audio file in whatsapp if there is any whitespace in the filename. But it works when sharing using email client. For filenames without spaces also it works fine. Below is the code which I am using Intent sharingIntent = new Intent(Intent.ACTION_SEND); File F =...

Error saving video Uri to SD card

android,android-intent,android-sdcard,android-file,android-videoview
I am trying to save a video from VideoView to the SD card, by touching the VideoView. No errors in LogCat, but my Toast I set up says "Error during video saving", which tells me my boolean I set up did not get to the part where it's set to...

Android - Retrieve a path of an picked image

java,android,android-intent,android-image,android-file
I have java code to pick an image from gallery or camera. In this code when user picks an image then it gets cropped into 200x200 size. I am looking for absolute path of that cropped image and I want to move that cropped image into SD card. But I...

Android: Is this method always available and present?

android,performance,storage,android-file
I want to make the most out root access to all folders. this order is correct and always available and present? File ffile = new File(Environment.getRootDirectory().getParent()); // return "/" // "/" out root access to all folders ...

How does the GDK android camera example work?

android,google-glass,google-gdk,abstraction,android-file
So I'm a little confused about what is going on towards the end of this code (inside processPictureWhenReady()). Before this method is called (within onActivityResult()) we have the image file path... So a file has already been stored. We then have the file declaration pictureFile using the filepath of the...