Using android studio
When I try to compile with this in the main activity it gives the error at the end of the post
The code i use:
public void buttonOnClick(View v) {
// do something when the button is clicked
Button button=(Button) v;
File from = new File(Environment.getInternalStorage().getAbsolutePath()+"/data/data/com.android.providers.contacts/databases/contacts2.db");
File to = new File(Environment.getExternalStorage().getAbsolutePath()+"/backup/contacts2.db");
from.renameTo(to);
Then I get this error :
Error:(25, 42) error: cannot find symbol method getInternalStorage()
Error:(26, 40) error: cannot find symbol method getExternalStorage()
Error:(34, 41) error: cannot find symbol method getExternalStorage()
Error:(35, 39) error: cannot find symbol method getInternalStorage()
Note: C:\Users\Alex\AndroidStudioProjects\QuickTransfer\app\src\main\java\com\am\tpz\quicktransfer\MainActivity.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Error:Execution failed for task ':app:compileDebugJava'.
> Compilation failed; see the compiler error output for details.
Information:BUILD FAILED