0

The path is of my local system looks like E:\Images\pic1.jpg

File file = new File(path);                                                                  
Log.d("swati","load bitmap from source "+file.getPath()+"  " +file.exists());                
  if (file.exists()) {                                                                       
 bitmap = BitmapFactory.decodeFile(file.getPath());                                       
 } 

the file.exists returns false thus causing null pointer exception ... please help

beginner
  • 383
  • 3
  • 5
  • 19
  • possible duplicate of [How can I let users access the internal storage directory of my app?](http://stackoverflow.com/questions/26579869/how-can-i-let-users-access-the-internal-storage-directory-of-my-app) – Kumar Saurabh Sep 03 '15 at 11:46
  • in the given link it solves problem for the data in the SDcard or in the device respective to the app .. but in my case i want to access data from local system i.e. laptop and not from device. the file.exists() itself returns false. so cant move forward to make stream or anything. – beginner Sep 03 '15 at 12:03
  • so u r using ur android on your laptop? – Kumar Saurabh Sep 03 '15 at 12:06
  • i am trying with the emulator – beginner Sep 03 '15 at 12:08
  • but your emulator is also an android device, have u tried working with the code given in other question? i think that shouls work as sooner or later u will test on android device for sure – Kumar Saurabh Sep 03 '15 at 12:12
  • If you want to access the image from the PC/laptop you need to write a server(could be in java) for that. You have to send a request to the server(PC) and it will send the respose to the client (emulator). – avinash Sep 03 '15 at 12:26

0 Answers0