Java tutorial
//package com.java2s; import android.database.Cursor; import java.lang.reflect.Field; public class Main { public static void keep_setFloat(Field field, Object obj, Cursor cursor, int i) { try { if (field.getType().equals(Float.TYPE)) field.setFloat(obj, cursor.getFloat(i)); else field.set(obj, Float.valueOf(cursor.getFloat(i))); } catch (Exception exception) { exception.printStackTrace(); } } }