The White House fountains has been green dyed. 🙂
The White House fountains has been green dyed. 🙂
Context ctx = getContext();
Display display = ((WindowManager)ctx.getSystemService(ctx.WINDOW_SERVICE)).getDefaultDisplay();
int width = display.getWidth();
int height = display.getHeight();
Yes, there are easier ways to retrieve the screen width on Android but there are cases that this long code is the only solution. You may already have the Context. WindowManager or the Display and so it would be smaller, but this code is more general.
$bric = array("Brazil", "Russia", "India", "China");
$ric = $bric; // array copy
$br = array_shift($ric); // left shift at $ric. $br stores "Brazil"
print_r($bric); // $bric remains the same
print_r($ric); // $ric lost "Brazil"
Output:
Array
(
[0] => Brazil
[1] => Russia
[2] => India
[3] => China
)
Array
(
[0] => Russia
[1] => India
[2] => China
)
Reference: PHP array_shift at php.net.
Testing the WordPress Android application.