Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.os.Bundle;

import java.util.Hashtable;
import java.util.Iterator;

public class Main {
    public static Bundle hashtableToBundle(Hashtable table) {
        Bundle bundle = new Bundle();

        Iterator iterator = table.keySet().iterator();
        String key;
        Object val;
        while (iterator.hasNext()) {
            key = (String) iterator.next();
            val = table.get(key);
            if (val instanceof Integer) {
                bundle.putInt(key, (Integer) val);
            } else if (val instanceof String) {
                bundle.putString(key, (String) val);
            }
        }
        return bundle;

    }
}