Reputation: 1064
I'm trying to upload a file to web server.But i'm having file not found exception.I think error comes from the path which i defined.my path is Sd card/Android/data/ic_launcher.png
Can anyone help me to give the path correctly.Please guys....
Upvotes: 0
Views: 1476
Reputation: 3578
String SD_Card_Path = Environment.getExternalStorageDirectory().toString();
String Complete_Path = SD_Card_Path + "/Android/data/ic_launcher.png";
This is the tested code Add External Storage Read/Write Permission in your AndroidMenifest and your code will be run.
Upvotes: 0
Reputation: 56925
Try this.
File file = new File(Environment.getExternalStorageDirectory(), "Android/data/ic_launcher.png");
add this permission in manifest file.
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
Upvotes: 1