intercept Byte Param from Bundle - Android android.os

Android examples for android.os:Bundle

Description

intercept Byte Param from Bundle

Demo Code

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

public class Main{

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

        if (savedInstanceState != null) {
            ret = savedInstanceState.getByte(paramName, (byte) 0);
        } else {/*  w w  w  .j  av  a2s.c  o  m*/
            if (intent != null) {
                Bundle incomming = intent.getExtras();
                if (incomming != null) {
                    ret = incomming.getByte(paramName, (byte) 0);
                }
            }
        }

        return ret;
    }

}

Related Tutorials