Zaid Iqbal
Zaid Iqbal

Reputation: 1682

Environment.getExternalStorageDirectory() not working in Android

As i need to load a file from SDCard when i am using Environment.getExternalStorageDirectory() or Environment.getExternalStorageDirectory().getAbsolutePath() but it is not working, well it works great with the "file:///sdcard/Avalon/assets/www/filename.html". I don't know what is happening with my path

cwv.loadUrl(Environment.getExternalStorageDirectory().getAbsolutePath()+"/Avalon/assets/www/filename.html", map);

I want make my path generic that's why i need to work it with any generic term...

Upvotes: 0

Views: 1701

Answers (1)

Zaid Iqbal
Zaid Iqbal

Reputation: 1682

Great it works... Actually i forgot to add "file://" So actual path should be

cwv.loadUrl("file://"+Environment.getExternalStorageDirectory().getAbsolutePath()+"/Avalon/assets/www/filename.html", map);

This is my mistake thanks

Upvotes: 1

Related Questions