2

How can I add multiple imageviews generated programmatically from linearlayout to room database. I have used byte for it but I can only store one image. I want to store all images in the same row

    
    ImageView imageview = new ImageView(this);

   linear.addView(imageView);  ``` 

  • Does this answer your question? [How to save images to Room Persistence Library](https://stackoverflow.com/questions/57117262/how-to-save-images-to-room-persistence-library) – Sky May 21 '22 at 09:11
  • Ok, when you generate the image, there are some ways to save it. First, but not the best, you can get the bitmap, convert to a byte array and save it. But it takes time, also it's not the best choice regarding performance if the image size is enormous. Instead, you can save that image in the internal storage and save the path of that image in the database. – Hayk Mkrtchyan May 21 '22 at 09:57
  • I didn't understand the question completely, could you explain the linear layout part again? – Hayk Mkrtchyan May 21 '22 at 09:58
  • The linear layout will be used to increase the number of imageviews, instead of adding the views to xml file manually. – Precious Peter May 22 '22 at 06:35

0 Answers0