Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse doesn't recognize Display object

When I write this code:

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

Eclipse doesn't pop up the functions of my display object. It shows these (new, nls, runnable, toarray) only:

How can I solve?

EDIT: Here are my imports:

import android.util.DisplayMetrics;
import android.view.Display;
import android.view.WindowManager;
like image 817
mhmtemnacr Avatar asked Mar 06 '26 12:03

mhmtemnacr


1 Answers

If you have updated to Eclipse Kepler recently (or perhaps, even if you haven't!), make sure "Java Proposals" is ticked under "Java/Editor/Content Assist/Advanced"

enter image description here

EDIT: I did not notice that your code block was not within any method and just in the body of your class. Move it into onCreate() or some other lifecycle method and it will work.

like image 94
Ken Wolf Avatar answered Mar 08 '26 01:03

Ken Wolf



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!