Hi I am trying to upload a file and a text, using multipart form-data HttpURLConnection java, sample of code below: additional details: I/File:: /storage/emulated/0/DCIM/100ANDRO/DSC_0117.JPG I/Api response: 400, Bad Request Note: I tested server from postman, and it working with no issues with Postman, the f…
Tag: android
Android File.listFiles() returns only subdirectories
I am trying to get all files and subdirectories in directory and show their names. This is the code I use: The specified directory(Environment.getExternalStorageDirectory()) contains files and subdirectories, but listFiles() only returns subdirectories. What’s wrong with this code? Permission to read ex…
Get the named of Collections from Document on Cloud Firestore
I want to get collections (Col01, Col02, Col03) from the document (Doc01). How can I approach this? Check the attached image. Thanks. Answer There is no API for getting a list of collection names that exist within your (Doc01) document. So, unfortunately, you cannot do that on Android. Because you are looking…
JSON file reading an array in Java AndroidStudio [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 1 year ago. Improve this question I’m trying to read data from JSON file in AndroidStudio with a format as follows: I wan…
How to scroll one to one in recycler view?
this is my adapter I want to scroll one item each time i scroll. Like when you see multiple images post on instagram. How can i do that? Thanks and my XML; Answer You can use a SnapHelper by attaching it to your RecyclerView with SnapHalper.attachToRecyclerView() and you will have a Scroll effect like instagr…
Android- Get a random number each time and call the value in another class
I wanted the ID to change 5 times when I click the button and not just a number repeated 5 times each time I click the button I already tried to put the variable ID in onCreate, even outside, but it …
java.io.FileNotFoundException open failed: EEXIST (File exists) Android 11
I was trying to download an image from a server and save it in the external memory, but in Android 11 it gives me an error when I try to create the file. I have granted permission to access the external storage. i searched a bit on the internet and they suggested me to put this code in the manifest,
Android studio – Java Null-pointer on Firebase invocation
The actual error I receive when running the program is: java.lang.NullPointerException: Attempt to invoke virtual method ‘com.google.firebase.database.DatabaseReference com.google.firebase.database.DatabaseReference.child(java.lang.String)’ on a null object reference This is my firebase database c…
Is Android AsyncTask use multithreading because android official web says?
while learning the difference between multi-threading and Concurrency.i follow this stackoverflow answer according to my understanding AsyncTask is just used to on or off the use of main thread{ui thread} while events like http request or fetching data from database. and after task is done main thead is reall…
How do I check if a field in another activity was filled? [closed]
Each user has its profile that is stored in a XML file linked to a Java class. But not necessarily they access this profile when they use the App, because they may just use the app without editing its …