Java tutorial
//package com.java2s; import android.os.Bundle; public class Main { private static final String NAME = "Name", NO_NAME = "!@#$%^&*()"; public static <E extends Enum<?>> void putEnum(Bundle b, String key, E value) { if (value == null) { b.putString(key + NAME, NO_NAME); } else { b.putString(key + NAME, value.getDeclaringClass().getName()); b.putString(key, value.name()); } } }