2

This is a weird question, but sometimes when my code throws exceptions Android Studios lets me click on the class name located in the LogCat and takes me specifically to that internal class where it generated the error.

I'm wondering if there is a way to view the source code for this manually, classes like StaticLayout, Button, Cursor etc without downloading some type of converter.

ProgrammingGorp
  • 103
  • 3
  • 11
  • If they are not native classes, then you need to download the jar and add them as a dependency – nLee Aug 18 '15 at 19:41

2 Answers2

1

From your question, it seems like you want to see the source of the Android classes like Button, StaticLayout and Cursor etc from your LogCat. You can download the Android source from the IDE by going to sdk manager from toolbar menus and downloading the Sources for Android SDK for your API level. Then when you click from these links, you'll be able to see the code behind.

Helpful link and source: Android Studio: how to attach Android SDK sources?.

Community
  • 1
  • 1
Shobhit Puri
  • 25,769
  • 11
  • 95
  • 124
  • Ok I understand, after installing the sources how do I actually view the classes? Is there a shortcut key I can use while hovering over the class name for example. – ProgrammingGorp Aug 18 '15 at 19:44
  • @ProgrammingGorp You should be able to click on the highlighted class names in your Exceptions that you see in your LogCat and it should open the file for you. Or if you just want to see the code of a specific class, use `Cmd` + `Shift` + `O` on mac and enter the file name like `Button.java` – Shobhit Puri Aug 18 '15 at 19:47
  • Yes! That was exactly what I am looking for. Thanks. – ProgrammingGorp Aug 18 '15 at 19:48
0

you can´t see the code because you don't have it. To see the code you must to have the .java file. Only have the .class file. To search an especific component you can search here grepcode Good Luck!

Rosendo Ropher
  • 496
  • 8
  • 21