Alienware
Alienware

Reputation: 64

Swipe to change image in imageview- android

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]);
    }

}

Upvotes: 2

Views: 11233

Answers (1)

Shadow
Shadow

Reputation: 6899

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/

Upvotes: 1

Related Questions