Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.database.Cursor;

public class Main {
    /**
     * Get the cursor
     * @param cursor Cursor from where read value
     * @param index int to read
     * @return Object read
     */
    private static Object getCursorValue(Cursor cursor, int index) {
        switch (cursor.getType(index)) {
        case Cursor.FIELD_TYPE_INTEGER:
            return Integer.valueOf(cursor.getInt(index));
        case Cursor.FIELD_TYPE_FLOAT:
            return Float.valueOf(cursor.getFloat(index));
        case Cursor.FIELD_TYPE_STRING:
            return cursor.getString(index);
        case Cursor.FIELD_TYPE_BLOB:
            return cursor.getBlob(index);
        default:
            return null;
        }
    }
}