Java – Eclipse does not recognize display objects

Eclipse does not recognize display objects… here is a solution to the problem.

Eclipse does not recognize display objects

When I wrote this code:

Display display = getWindowManager().getDefaultDisplay();
DisplayMetrics size = new DisplayMetrics();
display.

Eclipse does not pop up the ability of My Display objects. It only shows these (new, nls, runn, toarray):

How do I fix it?

Edit:
Here is my import:

import android.util.DisplayMetrics;
import android.view.Display;
import android.view.WindowManager;

Solution

If you’ve updated to Eclipse Kepler recently (or maybe, even if you don’t!), make sure to enter the Eclipse Kepler recently (or maybe, even if you don’t!), make sure to enter the Eclipse Kepler recently (or maybe, even if you don’t!), make sure to enter the “Java/Editor/ Content Assist/Advanced” under “Java Proposals”

enter image description here

EDIT: I didn’t notice that your code block is not in any method, but only in the body of your class. Move it into onCreate() or some other lifecycle method and it will work.

Related Problems and Solutions