Re: [android-developers] Re: How to use Tap Gesture???
Nice! as a side note... you might want to throw the @Override annotation on your overridden methods from OnGestureListener -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: How to use Tap Gesture???
Thanks a lot rich .. i got worked this way package pack.GestureSampleThree; import android.app.Activity; import android.graphics.Color; import android.os.Bundle; import android.view.GestureDetector; import android.view.MotionEvent; import android.view.GestureDetector.OnGestureListener; import android.widget.LinearLayout; import android.widget.TextView; public class GestureSampleThreeExample extends Activity implements OnGestureListener { private LinearLayout main; private TextView viewA; private GestureDetector gestureScanner; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); gestureScanner = new GestureDetector(this); main = new LinearLayout(this); main.setBackgroundColor(Color.GRAY); main.setLayoutParams(new LinearLayout.LayoutParams(320,480)); viewA = new TextView(this); viewA.setBackgroundColor(Color.YELLOW); viewA.setTextColor(Color.BLACK); viewA.setTextSize(16); viewA.setLayoutParams(new LinearLayout.LayoutParams(320,80)); main.addView(viewA); setContentView(main); } @Override public boolean onTouchEvent(MotionEvent me) { return gestureScanner.onTouchEvent(me); } public boolean onDown(MotionEvent e) { viewA.setText("-" + "DOWN" + "-"); return true; } public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { viewA.setText("-" + "FLING" + "-"); return true; } public void onLongPress(MotionEvent e) { viewA.setText("-" + "LONG PRESS" + "-"); } public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { viewA.setText("-" + "SCROLL" + "-"); return true; } public void onShowPress(MotionEvent e) { viewA.setText("-" + "SHOW PRESS" + "-"); } public boolean onSingleTapUp(MotionEvent e) { viewA.setText("-" + "SINGLE TAP UP" + "-"); return true; } } On Thu, Sep 8, 2011 at 12:02 AM, rich friedel wrote: > See nrmally when we have a button in a page in the onClick(View v ){ >> if(btn1==v) >> { >> >> startActivity(new >> Intent(FirstScreenActivity.**this,SecondScreenActivity.**class)); >> >> } >> >> } >> > > If that is the way you are doing it then I would (as others have) recommend > reading up on how to listen and respond to click events. I see absolutely no > reason to use an if/else statement when the listener is tied directly to the > button. > > Also you can make the ENTIRE view clickable: > http://developer.android.com/reference/android/view/View.OnClickListener.html > > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: How to use Tap Gesture???
try making the whole first page as a button , so that it looks better . But I dono if its feasible because me too new to android. On Tue, Sep 6, 2011 at 11:35 AM, sam wrote: > Is there any other way that u know i can achieve that .. cozz i dnt > want to keep a button the first screen .. i just need to touch the > screen to get into the second screen .. > > > > On Sep 6, 11:31 pm, Logesh rajendren wrote: > > There is also a method onTap() . I dono much about its functionalities . > you > > please check that. > > > > > > > > > > > > > > > > On Tue, Sep 6, 2011 at 10:48 AM, sam wrote: > > > Hi Guys , > > > > > Can u please guide me on how to use Tap gesture .. > > > > > I'm trying to enter into screen2 from screen1 when the user taps the > > > screen > > > > > How can i do that ?? > > > > > I googled a lot .. didn't get a clear idea ... > > > > > Can someone help me on this > > > > > Please > > > > > Cheers, > > > Sam > > > > > -- > > > You received this message because you are subscribed to the Google > > > Groups "Android Developers" group. > > > To post to this group, send email to > android-developers@googlegroups.com > > > To unsubscribe from this group, send email to > > > android-developers+unsubscr...@googlegroups.com > > > For more options, visit this group at > > >http://groups.google.com/group/android-developers?hl=en > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: How to use Tap Gesture???
This will work. Read up on android:id. Check the id of the click. If it is the button then do what you need to with the button, otherwise do what you need to with the screen. Thanks On Wed, Sep 7, 2011 at 12:05 AM, sam wrote: > Is there any other way that u know i can achieve that .. cozz i dnt > want to keep a button the first screen .. i just need to touch the > screen to get into the second screen .. > > > > On Sep 6, 11:31 pm, Logesh rajendren wrote: > > There is also a method onTap() . I dono much about its functionalities . > you > > please check that. > > > > > > > > > > > > > > > > On Tue, Sep 6, 2011 at 10:48 AM, sam wrote: > > > Hi Guys , > > > > > Can u please guide me on how to use Tap gesture .. > > > > > I'm trying to enter into screen2 from screen1 when the user taps the > > > screen > > > > > How can i do that ?? > > > > > I googled a lot .. didn't get a clear idea ... > > > > > Can someone help me on this > > > > > Please > > > > > Cheers, > > > Sam > > > > > -- > > > You received this message because you are subscribed to the Google > > > Groups "Android Developers" group. > > > To post to this group, send email to > android-developers@googlegroups.com > > > To unsubscribe from this group, send email to > > > android-developers+unsubscr...@googlegroups.com > > > For more options, visit this group at > > >http://groups.google.com/group/android-developers?hl=en > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- -- Raghav Sood CEO/Founder/Owner/Dictator/Tyrant at Appaholics (Basically all titles required to have complete control) http://www.raghavsood.com/ https://market.android.com/developer?pub=Appaholics http://www.appaholics.in/ -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: How to use Tap Gesture???
Your layout is basically an extension of the view class. Read the docs up. In your onClick method you will need to pass the view as a parameter. See the documentation at http://developer.android.com/ Thanks On Tue, Sep 6, 2011 at 11:52 PM, sam wrote: > wat u mean by put a view?? > > Can u give a brief explanation please ?? > > i'm new to android > > On Sep 6, 11:07 pm, Appaholics wrote: > > If that is all our app does is move from A to B then just put a view with > > height and width set the fill_parent and implement the onClick() method > for > > that view. > > > > Thanks > > > > > > > > > > > > > > > > > > > > On Tue, Sep 6, 2011 at 11:18 PM, sam wrote: > > > Hi Guys , > > > > > Can u please guide me on how to use Tap gesture .. > > > > > I'm trying to enter into screen2 from screen1 when the user taps the > > > screen > > > > > How can i do that ?? > > > > > I googled a lot .. didn't get a clear idea ... > > > > > Can someone help me on this > > > > > Please > > > > > Cheers, > > > Sam > > > > > -- > > > You received this message because you are subscribed to the Google > > > Groups "Android Developers" group. > > > To post to this group, send email to > android-developers@googlegroups.com > > > To unsubscribe from this group, send email to > > > android-developers+unsubscr...@googlegroups.com > > > For more options, visit this group at > > >http://groups.google.com/group/android-developers?hl=en > > > > -- > > -- > > Raghav Sood > > CEO/Founder/Owner/Dictator/Tyrant at Appaholics (Basically all titles > > required to have complete control) > http://www.raghavsood.com/https://market.android.com/developer?pub=Appaholicshttp://www.appaholics.in/ > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- -- Raghav Sood CEO/Founder/Owner/Dictator/Tyrant at Appaholics (Basically all titles required to have complete control) http://www.raghavsood.com/ https://market.android.com/developer?pub=Appaholics http://www.appaholics.in/ -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en