I'm storing a PNG file that is converted into a bitmap that gets converted into Byte[] and stored MySQL database.
When I try and call an Item in the database I get the following error.
E/SQLiteQuery: exception: Row too big to fit into CursorWindow requiredPos=0, totalRows=1; query: SELECT * FROM myTable
Caused by: android.database.sqlite.SQLiteBlobTooBigException: Row too big to fit into CursorWindow requiredPos=0, totalRows=1
Is there a way to increase the size of the Cursor window to accept the byte[]?
@Dao
public interface MyDAO {
@Query("SELECT * FROM myTable")
LiveData<List<MyEntity>>getAllImages();
public class MyRepository {
private MyDAO mMyDao;
private LiveData<List<MyEntity>> mList;
public MyRepository(Application application) {
MyDatabase db = MyDatabase.getInstance(application);
this.mMyDao = db.mMyDao();
mList = mMyDao.getAllImages();
}
public LiveData<List<MyEntity>> getAllImages(){
return mList;
}
import java.util.List;
public class MainViewModel extends AndroidViewModel {
private MyRepository mRepository;
private LiveData<List<MyEntity>> mList;
public MainViewModel(Application application) {
super(application);
mRepository = new MyRepository(application);
mList = mRepository.getAllImages();
}
public LiveData<List<MyEntity>> getList() {
return mList;
}
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final MainViewModel myViewModel = ViewModelProviders.of(this).get(MainViewModel.class);
Button btnLog = findViewById(R.id.btn_log);
btnLog.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.d("MyLog", "update Log");
myViewModel.getList().observe(MainActivity.this, new Observer<List<MyEntity>>() {
@Override
public void onChanged(List<MyEntity> myEntities) {
int listSize = myEntities.size();
Log.d("MyLog", "LiseSize " + listSize);
for(int i = 0; i < listSize; i++) {
Log.d("MyLog", "MyID " + myEntities.get(i).getID() +
", bitmap " + myEntities.get(i).getPHOTO());
}
}
});
}
});
I was expecting to see the byte[] in the log cat