Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.content.Context;

import android.content.SharedPreferences;

import android.util.Log;

public class Main {
    public static final String TAG = "SamcodesNotifications";
    public static final String LAST_BADGE_COUNT_TAG = "lastbadgecount";

    public static int getApplicationIconBadgeNumber(Context context) {
        SharedPreferences prefs = getApplicationIconBadgeSettings(context);
        if (prefs == null) {
            Log.i(TAG, "Failed to retrieve application icon badge number");
            return 0;
        }
        Log.i(TAG, "Getting application icon badge number");
        return prefs.getInt(LAST_BADGE_COUNT_TAG, 0);
    }

    public static SharedPreferences getApplicationIconBadgeSettings(Context context) {
        return context.getSharedPreferences("notificationsiconbadge", Context.MODE_WORLD_READABLE);
    }
}