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