How do you get/set media volume (not ringtone volume) in Android?

private AudioManager audio; Inside onCreate: audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE); Override onKeyDown: @Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_VOLUME_UP: audio.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_RAISE, AudioManager.FLAG_SHOW_UI); return true; case KeyEvent.KEYCODE_VOLUME_DOWN: audio.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_LOWER, AudioManager.FLAG_SHOW_UI); return true; default: return false; } }

Maven: downloading files from url

If the file is a Maven dependency, you could use the Maven Dependency Plugin which has a get goal. For any file, you could use the Antrun plugin to call Ant’s Get task. Another option would be the maven-download-plugin, it has been precisely created to facilitate this kind of things. It’s not very actively developed … Read more

Retrofit and GET using parameters

AFAIK, {…} can only be used as a path, not inside a query-param. Try this instead: public interface FooService { @GET(“/maps/api/geocode/json?sensor=false”) void getPositionByZip(@Query(“address”) String address, Callback<String> cb); } If you have an unknown amount of parameters to pass, you can use do something like this: public interface FooService { @GET(“/maps/api/geocode/json”) @FormUrlEncoded void getPositionByZip(@FieldMap Map<String, String> … Read more

PHP: $_GET and $_POST in functions?

When do you you need to include POST and GET methods as parameters to functions? I would say “never”: $_GET and $_POST are what is called superglobals: they exists in the whole script; which means they exist inside functions/methods. Especially, you don’t need to you the global keyword for those. Still, relying on those in … Read more

How to download HTTP directory with all files and sub-directories as they appear on the online files/folders list?

Solution: wget -r -np -nH –cut-dirs=3 -R index.html http://hostname/aaa/bbb/ccc/ddd/ Explanation: It will download all files and subfolders in ddd directory -r : recursively -np : not going to upper directories, like ccc/… -nH : not saving files to hostname folder –cut-dirs=3 : but saving it to ddd by omitting first 3 folders aaa, bbb, ccc … Read more

Get Text From Tag Using PHP

In order to get both the label and the value using just PHP, you need to have both arguments as part of the value. For example: <select name=”make”> <option value=”Text:5″> Text </option> </select> PHP Code <?php $parts = $_POST[‘make’]; $arr = explode(‘:’, $parts); print_r($arr); Output: Array( [0] => ‘Text’, [1] => 5 ) This is … Read more