0
I have a listview which displays the files from an external folder (usb). I want to select one of these files and save in an internal folder (Basket).
Here it is when I select an item of this mine listview, i get the position of the item, but from here, do not know how to save this item in the internal folder. I appreciate any help from now on.
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int posicao, long l) {
valor = (String) listView.getItemAtPosition(posicao);
File arquivo = (File) listView.getItemAtPosition(posicao);
Thank you very much. It’s helping a lot, but since I’m a beginner I have some difficulties, in case the origin I can pass by parameter, but the destination I created so File Folder = new File(Environment.getExternalStorageDirectory() + File.separator + "Basket"); hence when I pass this by parameter, it is of the type java.lang.String, and I am going through parameters of the type java.io.File. I would have to convert this to io.File, but I don’t know how yet.
– JFS
If your file
folder
is being created correctly this shouldn’t happen. But it seems to me that there is an error in your code, methodgetExternalStorageDirectory()
returns an object of typeFile
according to the very reference of android. If you want to search the address use:getExternalStorageDirectory().getPath()
this yes will return the address. Remember to be careful as they are not all devices that have SD card.– Guilherme Batista