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

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -