Quiere hacer una aplicación de Android /muy/ básica para copiar el contenido de una carpeta a otra y luego cambiarles el nombre

Basically, I'd like to have a simple Android application that just consists of one button (called something like copy) that when pressed, would scan a directory on the root of my internal storage for files, copy those files to another place on my internal storage, and then remove the .txt file extension from them.

I have read a few books of Java and got comfortable with some basics, and even started a couple books on Android. However, I am just lost on where to start. I know of IO streams, but through googling found other (quicker?) ways to do this. Just not sure how I can create the app right now.

I also understand this may be a very basic question, and with no code attached, but please be kind to my noobness lol. Just not sure how to get the copying/renaming done.

¡Gracias!

preguntado el 08 de febrero de 14 a las 14:02

You are not reffering to a problem. Start with simple tutorials on how to build your first application like this:developer.android.com/training/basics/firstapp/index.html?hl=cn When you made this app functional on your phone, then u can start editing the app to you own needs. And if a problem occurs u cant solve by first searching the web, then you come back here :) -

@user3284107 I know how to make my first app. I have followed the tutorials on the website. Just not sure how to do the under the hood stuff of copying/renaming. -

1 Respuestas

Google's Guava library makes such operations trivial. You can find out more in the documentation here: http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/io/Files.html.

Respondido 08 Feb 14, 14:02

So if there is an unknown amount of files in a directory. Would I need to: Get a count of all files in the directory by putting them in an array. Then have a for loop to cycle through them and copy(File from, File to)? Also, with the copy method, do I copy the file itself ("from") to the directory ("to")? - David

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.