Java tutorial
//package com.java2s; import android.content.Context; public class Main { public static int getSharedTokenId(Context context) { int i; try { i = context.getSharedPreferences(context.getPackageName(), 1).getInt("session_token_id", 0); } catch (Exception exception) { return 0; } return i; } }