Reactions of: public boolean onTrackballEvent(MotionEvent event)

by cruiseru...@gmail.com » Tue, 17 Mar 2009 01:32:32 GMT


Sponsored Links
 I override onTrackBallEvent but I have problem .It has good reaction
for action move ... when I track left, it goes left, when I track
right, it goes right, but I can't stop it .When I unpress ..
(action_up) the track ball .. it does nothing... still continue to
move. It does stop moving only when I track up or down....

I have no action_up or action_cancel,down reactions ... only
action_move react.


thread.sprite.moveleft or right ... is moving my sprite untlil a call
sprite.stayStil...

Logically it should be at ACTION_UP .... but it do nothing


@Override
    public boolean onTrackballEvent(MotionEvent event) {
        switch (event.getAction()) {
        case MotionEvent.ACTION_DOWN:
                thread.sprite.stayStill();
               // trackball selected... ignore
               break;
        case MotionEvent.ACTION_UP:
                thread.sprite.stayStill();
                return true;
        case MotionEvent.ACTION_CANCEL:
               // trackball selected... ignore
                thread.sprite.stayStill();
                return true;
        case MotionEvent.ACTION_MOVE:
            if (mContext != null) {
               float x = event.getX() * event.getXPrecision();
               float y = event.getY() * event.getYPrecision();
               thread.xx=(int)x;//for debug, show on screen
               if(x<(int)0)thread.sprite.moveLeft();
               if(x>(int)0)thread.spritemoveRight();
               if(x==(int)0)thread.sprite.stayStill();
               x=0;
                return true;
            }
        }
        return super.onTrackballEvent(event);
    }

--~--~---------~--~----~------------~-------~--~----~



Reactions of: public boolean onTrackballEvent(MotionEvent event)

by cruiseru...@gmail.com » Tue, 17 Mar 2009 17:57:01 GMT


 Does have anybody experience with using trackball?
I try use trackball because DPAD emulation is not so good.

But i have no actions_up from trackball.

Thx for answers
--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Other Threads

1. Custom preference

I need to create a preference that looks similiar like the WiFi
selection screen in the OS preferences.  That screen has a ListView
that takes up the whole bottom of the screen.  I have figured out how
to add a ListView using a custom preference but I can't make it take
up the remaining space.  It is always just the size of a single
preference row.

@Override
protected View onCreateView(ViewGroup parent){

        LinearLayout layout = new LinearLayout(getContext());

        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.FILL_PARENT,LinearLayout.LayoutParams.FILL_PARENT);

        layout.setOrientation(LinearLayout.VERTICAL);

        list = new ListView(getContext());
        list.setLayoutParams(params);

        layout.addView(list);
        layout.setBackgroundColor(Color.GREEN);

        adapter = new ArrayAdapter<String>(getContext(),
android.R.layout.simple_list_item_1, new String[]{"abc", "def"});
        list.setAdapter(adapter);

        return layout;
}

-- 

2. Porting gingerbread on 2.6.31

hi.
what is difference between kernel 2.6.31 and 2.6.36.
can Gingerbread be ported on 2.6.31 kernel version.
Thanks

-- 

3. input event in gingerbread

4. NFC Smart poster and Tag reader

5. OOT: Paging Om Tony Piter

6. UAC based on sip

7. Problems with getting signal strength