Convert Bundle to URL query String - Android android.os

Android examples for android.os:Bundle

Description

Convert Bundle to URL query String

Demo Code

import android.os.Bundle;

public class Main {

  public static String deserialBundle(Bundle bundle) {
    if (bundle == null)
      return null;
    StringBuilder params = new StringBuilder();
    for (String key : bundle.keySet()) {
      params.append(key + "=" + bundle.get(key) + "&");
    }/*ww  w .java 2  s  .co  m*/

    return params.length() > 0 ? params.substring(0, params.length() - 1) : null;
  }

}

Related Tutorials