Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Images slide show in android

I want to show images as slide show in android. That images will come from the server in the json data format. Can you tell me how i can pass that images in the images slider that will display the images. number of images coming from the server in json, it is totally dynamic, a group of images...

like image 207
Preet_Android Avatar asked May 07 '12 09:05

Preet_Android


People also ask

How do I view a slideshow on Android?

To start a slideshow, just head to an album, select a picture and tap the overflow dropdown menu. From there, simply select slideshow and you're good to go.


1 Answers

Intially you need to do is to take the count of the images coming from the json.As you get all the images you can show it to user using the horizondal pages.It helps to change the image in each swipe like in this link .Otherwise you can use two frames and can set two animations and show it like an slider.I think this piece of code will help you.

if (imagesetflag == true) {
                Right_to_left_in = AnimationUtils.loadAnimation(this,
                        R.anim.right_to_left_in);
                Right_to_left_out = AnimationUtils.loadAnimation(this,
                        R.anim.right_to_left_out);
                left_to_Right_in = AnimationUtils.loadAnimation(this,
                        R.anim.left_to_right_in);
                Left_to_Right_out = AnimationUtils.loadAnimation(this,
                        R.anim.left_to_right_out);

                frame1.setImageBitmapReset(decryptedimage, 0, true);
                TVpagenum.setText("Page no:" + Currentpage + "/"
                        + countOfPages);
                frame1.bringToFront();
                frame1.setVisibility(View.VISIBLE);
                frame2.setVisibility(View.INVISIBLE);
                frame1.setAnimation(Right_to_left_in);
                frame2.setAnimation(Right_to_left_out);                                     
                imagesetflag = false;
            } else {
                Right_to_left_in = AnimationUtils.loadAnimation(this,
                        R.anim.right_to_left_in);
                Right_to_left_out = AnimationUtils.loadAnimation(this,
                        R.anim.right_to_left_out);
                left_to_Right_in = AnimationUtils.loadAnimation(this,
                        R.anim.left_to_right_in);
                Left_to_Right_out = AnimationUtils.loadAnimation(this,
                        R.anim.left_to_right_out);

                frame2.setImageBitmapReset(decryptedimage, 0, true);
                TVpagenum.setText("Page no:" + Currentpage + "/"
                        + countOfPages);
                frame2.bringToFront();
                frame2.setVisibility(View.VISIBLE);
                frame1.setVisibility(View.INVISIBLE);
                frame2.setAnimation(Right_to_left_in);
                frame1.setAnimation(Right_to_left_out);                 
                imagesetflag = true;
            }
like image 90
Sreedev Avatar answered Sep 21 '22 06:09

Sreedev