android developer
android developer

Reputation: 116362

Eclipse content assist problems

On some cases that Eclipse can assist me with CTRL+SPACE in order to complete a function call, I get the function call with the parameters, but the parameters names are wrong and are simply named "arg0", "arg1", ...

For example: if I make a spinner and start to call:

spinner.setOnItemClickListener(new OnItemClickListener() ...

I then get the extra :

{
  @Override
  public void onItemClick(final AdapterView<?> **arg0**, final View **arg1**, final int **arg2**, final long arg3)
  {
  }
});

While the API of Android has clear names for those (as written here):

onItemClick(AdapterView<?> parent, View view, int position, long id)

Why does it occur, and what can I do to fix it? Btw, I have the latest version of Eclipse, JDK, Android adt & sdk (even occurred on version 20 preview 3).

Upvotes: 2

Views: 403

Answers (1)

K_Anas
K_Anas

Reputation: 31466

Eclipse can't work out the arguments because it can't find the source or javadoc attachments.

Make sure your source is attached.

Try the following solution?

  1. In eclipse, right click on your Android project and select Properties
  2. On the menu on the left, select "Java Build Path"
  3. On the right hand side, select the "tab" labelled "Libraries".
  4. Here you should see the Android SDK that you're targeting. For example: "Android 2.2".
  5. Click on the arrow to the left of the Android SDK to expand the sublevels.
  6. Find "Android.jar" and click on the arrow to the left of that one as well to expand it.
  7. You'll see a setting called "Javadoc location". Select that and then click on the "Edit" button.
  8. At the top, RESELECT the path to your javadocs. This is usually "path_to_android_sdk/android-sdk-mac_86/docs/reference/". I say RESELECT because even if it's right, you should browse and do it over anyway.
  9. Click on "validate". You should be all set now!

Mentioned here and here.

Upvotes: 2

Related Questions