intercept Double Param from Bundle - Android android.os

Android examples for android.os:Bundle

Description

intercept Double Param from Bundle

Demo Code

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

public class Main{

    public static double interceptDoubleParam(Bundle savedInstanceState,
            Intent intent, String paramName) {
        double ret = 0;

        if (savedInstanceState != null) {
            ret = savedInstanceState.getDouble(paramName, 0);
        } else {/*from ww  w  . j av a  2 s.  c o  m*/
            if (intent != null) {
                Bundle incomming = intent.getExtras();
                if (incomming != null) {
                    ret = incomming.getDouble(paramName, 0);
                }
            }
        }

        return ret;
    }

}

Related Tutorials