I need to use a file of type .dat in Android, but I cannot reference to the file ,application doesnt realize that file
Is that code correct?
File sdcard=Environment.getExternalStorageDirectory();
File file=new File(sdcard,"dictionary.dat");
if(file.exists()){
Toast.makeText(context,"file exists",Toast.LENGTH_LONG).show();
}
else{
Toast.makeText(context,"NOT exists",Toast.LENGTH_LONG).show();
}
String path=file.getAbsolutePath();
FileInputStream fis=new FileInputStream(path);
DataInputStream dawgDataFile=new DataInputStream(fis);
maybe I coded in wrong way, I just need to use “dictionary.dat” file , and I have stored it in raw folder. Button application says “NOT exists” . help please
you cannot get a file saved in RAW folder like that. This is how you can do it:
P.S. when saving files in RAW folder, file extensions can be omitted as they are not available when referencing in code