sry for not being very clear,
ps have a look at it.
(Quick note: In every single case you call
int xxx = mDraggableView.getDragItemId();
When dragging from the gallery, you call it 'fromPosition'; when dragging
from the grid, you just call it 'position'. Since you *always* make this
same call, why not just have
int fromPosition = mDraggableView.getDragItemId();
at the beginning once, outside of the chain of ifs? It would then streamline
your remaining code a little. It won't fix the problem, but it would make it
easier to follow as there would be less [repetitive] code.
Also, when providing sample code for a problem, please try to only show code
around the suspected problem itself unless asked specifically for more - in
this case we only needed to see where you remove it from the grid and try to
clear the selection!)
These appear to be the relevant lines:
draggableGallary.requestFocus();
draggableGrid.setSelection(-1);
A couple of things:
1. Try calling requestFocus() *after* setSelection(). I doubt it will make
any difference, but it's worth a try for five seconds of effort.
2. Try calling draggableGrid.invalidate() after those two lines. It might
force the grid to repaint, removing the focus rectangle.
3. Can the gallery actually *accept* the focus? If it can't, then trying to
give it the focus is probably failing and throwing the focus back where it
came from - onto the grid. Make sure that you call setFocusable(true) and
setFocusableInTouchMode(true) on the gallery view.
4. If all else fails, a dirty trick that might just work is that when the
grid has no items left, remove it from its parent view and then re-add it,
if feasible. The act of removing it should make absolutely sure it loses the
focus, and it *shouldn't* automatically get it back when you re-add it. Not
really a recommended solution but if it helps with the focus problem... then
so be it.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en