views:

24

answers:

0

Late hour @ work, brain turned off. I have 1 big set of images with different categories. User can choose to view all images or from 1 category only via dialog option. How should I change the default set for image adapter?

Currently the code is rly messy, but images are like:

private Integer[] images = { R.drawable.img1, R.drawable.img2, R.drawable.img3 };
private String[] authors = { "John B." , "Bob B." , "George H." };
private String[] titles = { "some river" , "Landscape of something" , "Office" };
private String[] Categories = { "Nature" , "Nature" , "Business" };

Since Android/Java doesn't have Structs I just use similar arrays with synchronized indexes. Really bad solution I guess. I scan use something like array of some static class?

Function that displays the image via adapter:

public void show() { 
if (direction == "next")
this.imgView.setAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_left));
else if (direction == "prev")
this.imgView.setAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_right));
this.imgView.setImageResource(Images[currImgVar]);
}

How can I send some specific subset of Images[] to the adapter so that Next/Previous would be other images from category instead of all ? And it needs to be possible to change it back to view full set.