简体   繁体   中英

How to find out which layout is using in running apk in android?

I have my apk in eclipse and run it on device. In my apk is a lot of layouts (sw240, sw300, sw340 sw360, etc) and on layout which is loaded is a bug. But I known nothing about device so I want to know from eclipse (or some another way) which layout is using now on device (when I start my apk from eclipse on device).

Is a way?

i ussually use this code below to know which layout i run if i have many layout design size:

Display display = ((WindowManager) getSystemService(WINDOW_SERVICE))
                .getDefaultDisplay();

int orientation = display.getOrientation();

// use this to see on your console
System.out.println("Screen Size: " + orientation);

// use this to see on logcat
Log.v(TAG, "Screen Size:" + orientation);

from that i think you can know which layout size that load when you execute the application.

I found something like that:

DisplayMetrics m = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(m);
Log.d(TAG, "@@@@@@ " + m);

but it is not exactly what I wanted. But I'm closer.

So how recalculate result like this

DisplayMetrics{density=0.75, width=320, height=240, scaledDensity=0.75, xdpi=132.52174, ydpi=133.2459}

on swXXXX?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM