GET vs POST in AJAX?

You should use the proper HTTP verb according to what you require from your web service. When dealing with a Collection URI like: http://example.com/resources/ GET: List the members of the collection, complete with their member URIs for further navigation. For example, list all the cars for sale. PUT: Meaning defined as “replace the entire collection … Read more

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; } }

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

Android – Dynamically Get the Current Activity in Foreground

I’m not sure if this is what you’re looking for, but it seemed pretty straightforward. http://iamvijayakumar.blogspot.com/2011/09/get-current-activity-and-package-name.html ActivityManager am = (ActivityManager) this .getSystemService(ACTIVITY_SERVICE); List<RunningTaskInfo> taskInfo = am.getRunningTasks(1); ComponentName componentInfo = taskInfo.get(0).topActivity; Log.d(WebServiceHelper.TAG, “CURRENT Activity ::” + taskInfo.get(0).topActivity.getClassName()+” Package Name : “+componentInfo.getPackageName()); Hope this helps.

how to get GET variable’s value in javascript? [duplicate]

var $_GET = {}; if(document.location.toString().indexOf(‘?’) !== -1) { var query = document.location .toString() // get the query string .replace(/^.*?\?/, ”) // and remove any existing hash string (thanks, @vrijdenker) .replace(/#.*$/, ”) .split(‘&’); for(var i=0, l=query.length; i<l; i++) { var aux = decodeURIComponent(query[i]).split(‘=’); $_GET[aux[0]] = aux[1]; } } //get the ‘index’ query parameter alert($_GET[‘index’]);