1

I have Imageview in center of screen.

I want to swipe Imageview left and right of the screen.How can i implement this?

Mayuri Joshi
  • 164
  • 1
  • 2
  • 12
  • you can go through: http://stackoverflow.com/questions/15481524/how-to-programatically-answer-end-a-call-in-android-4-1 or http://stackoverflow.com/questions/26924618/how-can-incoming-calls-be-answered-programmatically-in-android-5-0-lollipop based on your needs. – Digish Gabhawala Sep 21 '15 at 04:19
  • I have code of accept and reject call i want to implement swipable view how can i implement that ? – Mayuri Joshi Sep 21 '15 at 04:25

2 Answers2

1

Have a look at https://github.com/nadavfima/GlowPadView .

It has open source implementation of glowpadview.

you can use it as a reference and change icons as per your need. It should create that swipable view.

  • Thanks its working but how to resize it? In small device it does not fit. – Mayuri Joshi Sep 25 '15 at 13:27
  • After 2 days when i open my project i got this error and Glowpadview is not launching. Application is crashed what should i do? The following classes could not be instantiated: - com.fima.glowpadview.GlowPadView (Open Class, Show Error Log) See the Error Log (Window > Show View) for more details. Tip: Use View.isInEditMode() in your custom views to skip code when shown in Eclipse – Mayuri Joshi Sep 28 '15 at 04:56
  • I am not very sure but I think Its simple UI library so maybe try making sure that all dependencies in your project are proper. This library should be there as a dependency of your main project. It should have no other problem. – Digish Gabhawala Sep 28 '15 at 14:12
0

I was also looking for some very simple solution to this. I just needed left/right swipe. I found many solutions which were overly complicated. So I reduced what I found as much as I can and came up with something really simple (the swipe will work on a div with ID mainarea in this example, swipes are detected for minimum 100px to either side):

var swipe={
 startx:0,touch:function(event) {
 if (typeof event.touches!=='undefined') {
   switch (event.type) {
    case 'touchstart':swipe.startx=event.touches[0].pageX;
    case 'touchend':
     if(Math.abs(swipe.startx-event.changedTouches[0].pageX)>100)
      swipe.startx<event.changedTouches[0].pageX?window.location.href=swipe.prev:window.location.href=swipe.next
   }
  }
 },init:function(prev,next){
  swipe.prev=prev;
  swipe.next=next;
  document.getElementById("mainarea").addEventListener('touchstart',swipe.touch,false);
  document.getElementById("mainarea").addEventListener('touchend',swipe.touch,false);
 }
}
swipe.init(<previous page>,<next page>);
B_pi_P
  • 41
  • 9