android - Swipe image views left and right like a drag and drop -


i have image view. want touch image , drag left or right. when image dragged left, new image should appear array. when drag right should saved in activity. how can possibly this, if guide me tutorial or example. thank-you

you can use viewpager , pageadapter.

protected class imagepageradapter extends pageradapter {      public imagepageradapter() {     }      @override     public int getcount() {         return getimages().size();     }      @override     public boolean isviewfromobject(view view, object o) {         return view == o;     }      @override     public void destroyitem(viewgroup container, int position, object object) {         container.removeview((view) object);     }      @override     public object instantiateitem(viewgroup container, int position) {         layoutinflater inflater = (layoutinflater) container.getcontext()                 .getsystemservice(context.layout_inflater_service);         view view = inflater.inflate(r.layout.image_page_view, null);         string url = getimages().get(position);         if (url != null) {             imageloader.getinstance().displayimage(url, (imageview) view.findviewbyid(r.id.image_page_view));         }         container.addview(view, 0);         return view;     } }  ... imagepager.setonpagechangelistener(new viewpager.onpagechangelistener() {             @override             public void onpagescrolled(int i, float v, int i2) {             }              @override             public void onpageselected(int i) {                 //logic open activity or other action..;             }              @override             public void onpagescrollstatechanged(int i) {             }         });  ... imagepager.setadapter(new imagepageradapter()); 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -