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 {
    public static float getFloatFromCursor(Cursor cursor, String columnName) {
        float value = -1;
        if (cursor != null && cursor.getPosition() >= 0 && cursor.getPosition() < cursor.getCount()) {
            int columnIndex = cursor.getColumnIndex(columnName);
            if (columnIndex >= 0) {
                value = cursor.getFloat(columnIndex);
            }
        }
        return value;
    }
}