Answer the question
In order to leave comments, you need to log in
How to swap the contents of files?
In general, I have 2 fields EditText(id - filepath, filepath2), button(id-perform). You need to swap the contents of the files. The bottom line is that when you enter the correct path to the objects, they exchange values, otherwise "error" is displayed. If there are any errors in the code, I will be glad to hear. Thanks in advance!
perform.setOnClickListener {
val path1 = File(
Environment.getExternalStorageDirectory(),
"$filepath")
val path2 = File(
Environment.getExternalStorageDirectory(),
"$filepath2")
val fileExists1 = path1.exists()
val fileExists2 = path2.
}
else filepath.setText("error", TextView.BufferType.EDITABLE)
if(fileExists2) {
}
else filepath2.setText("error", TextView.BufferType.EDITABLE)
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question