Please somebody help me with this..... On 19 February 2012 11:12, kumar raja <rajkumar.cs...@gmail.com> wrote:
> i have an application which has the following layout. > > a b c d e > f g h i j > > and one string,.say str > > and i am implementing ontouchlistener and using ontouch(View V,MotionEvent > M) > > my task is to achieve when a button say 'c' is touched the str set to > "down c". it is done by using ACTION_DOWN recognition . > > But after that before the ACTION_UP event , if the user slides to 'd' > then it should be recognized. and str should set to "b down". > > i am not getting by what methods or events i can achieve this. whether i > need to use keyevent, hoverevents or touchevents > > i am not getting the answer . and i am in a really need of it. i have > posted my code. SO someone please give me an idea of how to solve this. > > > for (int i = 0; i < mybtn.length; i++) > > { > > String btnid = "btn" + i; > > int resid = getResources().getIdentifier(btnid, "id", > > getPackageName()); > > mybtn[i] = (Button) findViewById(resid); > > mybtn[i].setOnTouchListener(this); > > > } > > > public boolean onTouch(View v, MotionEvent event) > { > > // TODO Auto-generated method stub > > String s = null; > > s = ((Button) v).getText().toString().trim(); > > > switch (event.getAction()) { > > // case MotionEvent.ACTION_MOVE: > // Do some stuff > // et.setText("move android"+s, TextView.BufferType.EDITABLE ); > > // break; > > case MotionEvent.ACTION_DOWN: > > current = Integer.valueOf(s); > > et.setText("down android" + s, TextView.BufferType.EDITABLE); > > // Do some stuff > break; > case MotionEvent.ACTION_UP: > > et.setText("up android" + s, TextView.BufferType.EDITABLE); > > break; > case MotionEvent.ACTION_MOVE: > > if (current != Integer.valueOf(s)) { > > current = Integer.valueOf(s); > > } > break; > > } > > return false; > } > > } > > > > -- > Regards > Kumar Raja > M.Tech(SIT) > IIT Kharagpur, > 10it60...@iitkgp.ac.in > > > -- Regards Kumar Raja M.Tech(SIT) IIT Kharagpur, 10it60...@iitkgp.ac.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