intercept Long Param from Bundle - Android android.os

Android examples for android.os:Bundle

Description

intercept Long Param from Bundle

Demo Code

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

public class Main{

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

        if (savedInstanceState != null) {
            ret = savedInstanceState.getLong(paramName);
        } else {/*from  w  w  w  .  ja va  2s . co m*/
            if (intent != null) {
                Bundle incomming = intent.getExtras();
                if (incomming != null) {
                    ret = incomming.getLong(paramName);
                }
            }
        }

        return ret;
    }

}

Related Tutorials