0

I'm trying to access the external storage directory path and displaying it in the Toast, just to see what it is.

For the code

String path = Environment.getExternalStorageDirectory().toString();

the path shown is "/storage/emulated/0"

But when i change the code to

String path = Environment.getExternalStorageDirectory().getAbsloutePath().toString();

My application crashes.. Why is it so?

Rohit S
  • 395
  • 4
  • 18
  • 1
    Your code will not compile, as there is no `getAbsloutePath()` method on `File`. I presume that you mean `getAbsolutePath()`. Beyond that, use LogCat to examine the Java stack trace associated with your crash: https://stackoverflow.com/questions/23353173/unfortunately-myapp-has-stopped-how-can-i-solve-this – CommonsWare May 15 '16 at 14:10
  • thank you, but it is showing in the logcat that....file not found – Rohit S May 15 '16 at 14:17
  • In pure java desktop applications, to display on the console we use System.out.println(). To know the flow of control between different methods in the program, where we put the System.out.println() we get the display. Similarly what can be done to get the flow of control in the Android development? The same System.out.println() is not workin gin the eclipse...it is not showing any output on the eclipse console... – Rohit S May 15 '16 at 14:20
  • 1
    "but it is showing in the logcat that....file not found" -- you may wish to edit your question to provide a [mcve], including the text of the full Java stack trace and the complete source code around where this crash is occurring. "The same System.out.println() is not workin gin the eclipse" -- it should be, though official Eclipse support has ended. "it is not showing any output on the eclipse console" -- it will show up in LogCat, along with any `Log` calls (e.g., `Log.e()`). See `android.util.Log`. – CommonsWare May 15 '16 at 14:25

0 Answers0