I write a demo of fragment, and under android 3.0, the method getWidth()
and getHeigh()
is deprecated. and i read the api, found that getSize(point)
is the same with the two method ,so i try it .
Display d = wm.getDefaultDisplay();
int width=0;
int height=0;
Point point = new Point(width,height);
d.getRealSize(point);
but when i run the app ,there occur an error,is there anybody found such problem?:
02-01 03:13:06.548: E/AndroidRuntime(558): FATAL EXCEPTION: main
02-01 03:13:06.548: E/AndroidRuntime(558): java.lang.NoSuchMethodError: android.view.Display.getRealSize
02-01 03:13:06.548: E/AndroidRuntime(558): at com.demo.fragment.FragmentDemoActivity.onCreate(FragmentDemoActivity.java:33)
02-01 03:13:06.548: E/AndroidRuntime(558): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
02-01 03:13:06.548: E/AndroidRuntime(558): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1700)