Swipe to change image in imageview- android

10,758

You can use in two ways.Jake Wharton's View Pager indicator

https://github.com/JakeWharton/Android-ViewPagerIndicator

or you can also use Page curl to swipe left or right

https://code.google.com/p/android-page-curl/

Share:
10,758
Alienware
Author by

Alienware

Updated on June 04, 2022

Comments

  • Alienware
    Alienware almost 2 years

    I have an imageview in my application, i want to show the next/previous image on swiping left/right. i found a tutorial here Image swiping and changing with buttons as well but don't know how to implement it. any help will be highly appreciated

    package com.example.androidhive;
    
    import android.app.Activity;
    import android.content.Intent;
    import android.os.Bundle;
    import android.widget.ImageView;
    
     public class FullImageActivity extends Activity {
    
     @Override
     public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.full_image);
    
        // get intent data
        Intent i = getIntent();
    
        // Selected image id
        int position = i.getExtras().getInt("id");
        ImageAdapter imageAdapter = new ImageAdapter(this);
    
        ImageView imageView = (ImageView) findViewById(R.id.full_image_view);
        imageView.setImageResource(imageAdapter.mThumbIds[position]);
        }
    
    }