When I override methods from the Android classes in Eclipse, I get useless parameter names like "arg0", "arg1" etc. For example when overriding methods from SQLiteOpenHelper
I get:
@Override
public void onCreate(SQLiteDatabase arg0) {
// TODO Auto-generated method stub
}
@Override
public void onUpgrade(SQLiteDatabase arg0, int arg1, int arg2) {
// TODO Auto-generated method stub
}
I've found various posts about this but none of the accepted solutions seem to work for me. It is also strange because it only seems to happen some of the time. For example the constructors in the above test had correctly named parameters.
I have got "Documentation for Android SDK" installed in the Android SDK Manager for Android 4.4.2. Do I still need to manually attach the docs (or even source?) somehow for this to work reliably, and if so how do I go about this?
Thanks!
As @greg-449 mentioned in the comments, the Android source needs to be attached for this to work.
Following the steps in this link seems to fix this.
In case the link is broken in future, the steps are:
Download "Sources for Android SDK" using the SDK Manager
Right click android.jar
in the Eclipse Package Explorer (under the Android {version}
node), and click properties
Under "Java Source Attachment", enter the path to the downloaded source directory which is along the lines of {sdk}/sources/android-{version}
I then get this:
@Override
public void onCreate(SQLiteDatabase db) {
// TODO Auto-generated method stub
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// TODO Auto-generated method stub
}
UPDATE: For reference, a similar problem occurs in Android Studio (v0.4.2 at the time of writing). Sources can be attached via File -> Other Settings -> Default Project Structure, select SDKs, android platform and add the source in the "Sourcepath" tab.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With