`MainActivity:
` package com.example.game;
import android.view.Window;
import android.view.View;
import android.widget.ImageView;
import android.widget.Button;
import android.widget.TextView;
import android.app.Activity;
import android.os.Bundle;
import java.util.HashMap;
public class MainActivity extends Activity {
public Database db = new Database();
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main_activity);
// inizializating varibales
db.main();
}
}`
Database:
`package com.example.game;
import java.lang.Exception;
import java.io.*;
import java.nio.file.Path;
public class Database {
public static void main(){
try {
FileReader fr = new FileReader("user.txt");
fr.close();
} catch (Exception e){
e.printStackTrace();
}
}
}``
I'm tried to add READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE to android manifest
Then I'm tried to check files in my dir by MainActivity program and it shows nothing.
I think you have not defined the path
instead you should use like
or the main path where user.txt exists
Hope it Helps!