1

I have a list of emotion icons(over 100 icons).
And I would like to display in a view that people can click it and toast what he is clicking.
emotion icons Now, I have some confusing points:
1) What views should I use to include all this icons (GridView or ListView)?
2) How to dynamic add them or add them pro-grammatically? If I declare each one by one, I think it is no good. But any other ideas?
All the images icons is in drawable folder. Thanks.

1 Answer 1

3

GridView would be better in this case with a PopupWindow. Take a HashMap and store the name of the smiley as String and its Image as Resource Id.

eg:-

HashMap<String, Integer> map = new  HashMap<String, Integer>();
map.put("smile", R.drawable.smile);
.... 

Now, Iterate through all the values(images) of HashMap and poplulate your GridView from the HashMap values(images).

And, inside Adapter class you can show images using map.get(key); to ImageView and set the Resource.

UPDATE:

I had just created a small demo for the same you can check it from here.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.