Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.database.Cursor;

public class Main {
    /**
     * Get the unread count for the given shortcut info
     * @param c cursor holding the unread counts
     * @param packageName the package we are looking for
     * @return int of the unread count
     */
    public static int getUnreadCount(Cursor c, String packageName) {
        int count = 0;

        try {
            if (c.moveToFirst()) {
                String currName = null;
                do {
                    currName = c.getString(c.getColumnIndex("package_name"));
                    if (currName.equals(packageName)) {
                        count = c.getInt(c.getColumnIndex("count"));
                    }
                } while (c.moveToNext());
            }
        } catch (Exception e) {

        }

        return count;
    }
}