show and format Content inside Bundle - Android android.os

Android examples for android.os:Bundle

Description

show and format Content inside Bundle

Demo Code

import java.util.Set;

import android.os.Bundle;

public class Main {

  public static final void showContent(Bundle bundle) {
    if (bundle == null) {
      return;//  ww  w .  ja  v a2  s  .  c  o m
    }

    StringBuilder builder = new StringBuilder();
    builder.append("bundle contnet\n");
    Set<String> keys = bundle.keySet();
    for (String key : keys) {
      builder.append("[" + key + "]<->[" + bundle.get(key) + "]\n");
    }
    String content = builder.toString();
    System.out.println(content);
  }

}

Related Tutorials