intercept String Param from Bundle - Android android.os

Android examples for android.os:Bundle

Description

intercept String Param from Bundle

Demo Code

import android.content.Intent;
import android.os.Bundle;
import android.os.Parcelable;

public class Main{

    public static String interceptStringParam(Bundle savedInstanceState,
            Intent intent, String paramName) {
        String ret = null;//from  w  ww.  j  av a  2  s. co m

        if (savedInstanceState != null) {
            ret = savedInstanceState.getString(paramName);
        } else {
            if (intent != null) {
                Bundle incomming = intent.getExtras();
                if (incomming != null) {
                    ret = incomming.getString(paramName);
                }
            }
        }

        return ret;
    }

}

Related Tutorials