php - android convert dip to pixels? -


my issue want re-size images inside post showing 2 images per row

my app send width of screen php api php api must convert dip pixels , set image width 50% of screen dip

this aim doing far

display d = getwindowmanager().getdefaultdisplay();   int w = display.getwidth();   int h = display.getheight();   string response = get_html_postinfo("bla.php?postid=1&h="+h+"&w="+w);  //response append webview 

in php side

$screen_dip_w = $_get['w']; $screen_dip_h = $_get['h'];  //i want dip converted pixel how ? $screen_px_w = ( ? x $screen_dip_w );  $set_image_w = $screen_px_w/2; 

any idea ? thank u

display.getwidth() , display.getheight() return size of screen in pixels, no conversion required.

also, recommend switching using display.getsize(point outsize) width , height methods deprecated.

developer.android.com/reference/android/view/display.html


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -