get the parameter string values passed into Activity via a Bundle - Android android.app

Android examples for android.app:Activity Property

Description

get the parameter string values passed into Activity via a Bundle

Demo Code

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Window;
import android.view.WindowManager;
import java.util.Map;
import java.util.Map;

public class Main{

    /**//from   www.  j av  a 2s . c  o  m
     * Used to get the parameter values passed into Activity via a Bundle.
     *
     * @return param Parameter value
     */
    public static String getExtraString(Activity context, String key) {
        String param = "";
        Bundle bundle = context.getIntent().getExtras();
        if (bundle != null) {
            param = bundle.getString(key);
        }
        return param;
    }

}

Related Tutorials