android-file

How to read a file from internal storage or external storage and store the file in a arrayList in android

僤鯓⒐⒋嵵緔 提交于 2020-07-23 07:51:18
问题 My requirement is the end-user must be able to upload files into the application from internal or external storage and finally display the name of the file in the page. Actual result: Now I've fetched the file name from the storage and displayed the name in my page. Expected Result: The end user must be able to load image or video files from external or internal storage to the application and finally display their name in the page. But don't have any idea about how to load read the file from

How to read a file from internal storage or external storage and store the file in a arrayList in android

笑着哭i 提交于 2020-07-23 07:50:10
问题 My requirement is the end-user must be able to upload files into the application from internal or external storage and finally display the name of the file in the page. Actual result: Now I've fetched the file name from the storage and displayed the name in my page. Expected Result: The end user must be able to load image or video files from external or internal storage to the application and finally display their name in the page. But don't have any idea about how to load read the file from

How to read a file from internal storage or external storage and store the file in a arrayList in android

↘锁芯ラ 提交于 2020-07-23 07:49:25
问题 My requirement is the end-user must be able to upload files into the application from internal or external storage and finally display the name of the file in the page. Actual result: Now I've fetched the file name from the storage and displayed the name in my page. Expected Result: The end user must be able to load image or video files from external or internal storage to the application and finally display their name in the page. But don't have any idea about how to load read the file from

Android Multipart file upload with access token

ぃ、小莉子 提交于 2020-06-17 04:55:09
问题 I want to send access token as a multipart data along with the file to the php server. I wrote the following code but it is giving 401 Unauthorized error. I think I am not passing the access_token. How to do it? public class UploadToServer extends Activity { TextView messageText; TLConstants tlConstants; Button uploadButton; int serverResponseCode = 0; ProgressDialog dialog = null; String upLoadServerUri = null; /********** File Path *************/ final String uploadFilePath = "/mnt/sdcard/"

Android: Too many open files error

孤者浪人 提交于 2020-05-11 05:38:30
问题 I have the following operation which runs every 3 seconds. Basically it downloads a file from a server and save it into a local file every 3 seconds. The following code does the job for a while. public class DownloadTask extends AsyncTask<String, Void, String>{ @Override protected String doInBackground(String... params) { downloadCommandFile( eventUrl); return null; } } private void downloadCommandFile(String dlUrl){ int count; try { URL url = new URL( dlUrl ); NetUtils.trustAllHosts();

How to write and Read a text file with custom extension?

 ̄綄美尐妖づ 提交于 2020-01-24 20:43:05
问题 In my app, I am creating a file and writing some data to it using SAF. I ask the user to enter the name and then save some data to the file. Similarly, I let the user chose the file from storage and read some data from it. I want to do this with my custom file extension say ".xyz". I found multiple sources with intent-filters, but what I know about intent filters is that they help you open the file with some app. I don't want to open my app when the file is clicked. I just want to access/read

how to get file(pdf, jpg, docs) from local storage and create File [duplicate]

ぃ、小莉子 提交于 2020-01-22 03:30:10
问题 This question already has answers here : Android - Get real path of a .txt file selected from the file explorer (1 answer) onActivityResult's intent.getPath() doesn't give me the correct filename (1 answer) Getting the Absolute File Path from Content URI for searched images (2 answers) Create a file from a photo URI on Android (1 answer) Closed 3 months ago . I tried to create file with intent data uri To create File, I start intent like this val intent = Intent(Intent.ACTION_GET_CONTENT)

how to save capture image in sdcard?

风格不统一 提交于 2020-01-22 02:17:07
问题 I want to use default camera and capture image. i want save image in sdcard/photofolder/ and save filename as curenttime format in sdcard/photofolder/ also display capture image in imageview page Uri outputFileUri = Uri.fromFile("/sdcard/Photofolder/"); Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri); startActivityForResult(intent, CAMERA_REQUEST); protected void onActivityResult(int requestCode, int

android.os.FileUriExposedException: file:///storage/emulated/0/test.txt exposed beyond app through Intent.getData()

别等时光非礼了梦想. 提交于 2020-01-16 16:25:59
问题 The app is crashing when I'm trying to open a file. It works below Android Nougat, but on Android Nougat it crashes. It only crashes when I try to open a file from the SD card, not from the system partition. Some permission problem? Sample code: File file = new File("/storage/emulated/0/test.txt"); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(file), "text/*"); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); // Crashes on this line

How to delete a file/folder in a SDCARD under Android Platform? [closed]

 ̄綄美尐妖づ 提交于 2020-01-15 06:59:43
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . I want to know how to delete a file/folder in SD Card. I tried the code below: File folder = Environment.getExternalStorageDirectory(); String fileName = folder.getPath() + "/LOST.DIR/ppt52.ppt"; File myFile =