0

This is my code to explain how to set horizontal scroll view.

 File targetDirector = new File(targetPath);

 File[] files = targetDirector.listFiles();

 for (int i = 0; i < 10; i++){
     if(files[i].getName().contains(".png"))
            myGallery.addView(insertPhoto(files[i].getAbsolutePath());
 }
galath
  • 5,717
  • 10
  • 29
  • 41

1 Answers1

0

That's a bad idea. HorizontalScrollView is not an AdapterView, meaning all your images will be stored in memory, meaning your app will be sluggish and slow, if not crash with OutOfMemoryException.

Better use TwoWayView for this.

agamov
  • 4,407
  • 1
  • 27
  • 31