TmTron
TmTron

Reputation: 19381

How to jump to the Android implementation source file in Android Studio

in Android Studio (2.2 Preview 2), I have the sdk sources attached and I can also jump to the interfaces of android sources: e.g. when I CTRL-click on SharedPreferences, the file ~/Android/Sdk/sources/android-23/android/content/SharedPreferences.java is opened.

But now I also want to jump to the implementation of this interface - or a member function e.g. getFloat()

How can this be done?

notes:

Upvotes: 1

Views: 2015

Answers (2)

TmTron
TmTron

Reputation: 19381

I found a workaround to easily get me to the implementation file:

  • Set the cursor to the interface-name SharedPreferences
  • Open the Find Usages dialogue (e.g. press CTRLALTSHIFT7). In the Scope box select Project and Libraries.
  • Click the Find button and the SharedPreferencesImpl class will show up in Found usages (under the Android API 23 Platform node)

Upvotes: 0

mrkernelpanic
mrkernelpanic

Reputation: 4451

Maybe I found the solution. The implementation class signature looks the following:

final class SharedPreferencesImpl implements SharedPreferences {

This is the default access modifier and means that it is only visible in the current package android.app. But your interface is defined in another package android.content thats why Android Studio cannot find the implementation.

But even If you click through your "External Libraries" in Android Studio of your project you cannot see the android.app.SharedPreferencesImpl class ...

Upvotes: 1

Related Questions