If we could, don't you think we would have done so by now?
>
> Have you *tried* calling setSelection(-1), or calling requestFocus() on
> another View to take the focus away from the GridView?
>
Well, I tried both of them, but nothing seems to work for me.
>
> Have you posted some code to show us how you perform the drag-n-drop, so
> that we might have a chance of seeing what might be wrong... or are you
> expecting us to magically fix code we can't see?
>
sry for not being very clear,
ps have a look at it.
public void OnDropEvent( int DropSourceAdapterViewID,
int dropCatchableViewID ,
int eventRecognition,
DraggableView mDraggableView,
int X, int Y) {
if(DropSourceAdapterViewID == R.id.gallery)
{
if(dropCatchableViewID == R.id.gallery)
{
if((eventRecognition >= 0 || eventRecognition
== DropCatchable.INSIDE))
{
int fromPosition =
mDraggableView.getDragItemId();
int toPosition = ((SlideShowPhoto)
gallaryItemAdapter.getItem(eventRecognition)).getPositionOnTimeline();
onSlideshowPhotoDropped(fromPosition,
toPosition);
}
else if(eventRecognition ==
DropCatchable.INSIDE_LEFT)
{
int fromPosition =
mDraggableView.getDragItemId();
onSlideshowPhotoDropped(fromPosition, 0);
}
else if(eventRecognition ==
DropCatchable.INSIDE_RIGHT)
{
int fromPosition =
mDraggableView.getDragItemId();
onSlideshowPhotoDropped(fromPosition,
gallaryItemAdapter.getCount());
}
}
else if(dropCatchableViewID ==
R.id.gridViewDragDrop)
{
int fromPosition =
mDraggableView.getDragItemId();
SlideShowPhoto sp =
AG.loadedProject.getProject_slideShowPhoto_list().get(fromPosition);
GridPhoto gp = new GridPhoto(sp.getImagePath());
gp.setThumbnailImagePath(sp.getThumbnailImagePath());
gp.setTimeStamp(sp.getTimeStamp());
gp.setThumbnailImageBitmap(sp.getThumbnailImageBitmap());
AG.loadedProject.getProject_gridPhoto_list().add(gp);
AG.loadedProject.getProject_slideShowPhoto_list().remove(fromPosition);
AG.loadedProject.reassignTimeLinePosition();
gallaryItemAdapter.notifyDataSetChanged();
draggableGallary.requestFocus();
draggableGrid.setSelection(-1);
gridItemAdapter.notifyDataSetChanged();
draggableGallary.requestFocus();
AG.loadedProject.setProjectStatePerfect(false);
// Log.e("from gallery" , "to grid " +
eventRecognition);
}
}
else if(DropSourceAdapterViewID == R.id.gridViewDragDrop)
{
if(dropCatchableViewID == R.id.gallery)
{
if((eventRecognition >= 0 || eventRecognition
== DropCatchable.INSIDE))
{
findViewById(R.id.dragtxt).setVisibility(View.GONE);
int position =
mDraggableView.getDragItemId();
GridPhoto mGridPhoto =
gridItemAdapter.getItem(position);
onGridPhotoDropped(mGridPhoto,
eventRecognition);
}
else if(eventRecognition ==
DropCatchable.INSIDE_LEFT)
{
findViewById(R.id.dragtxt).setVisibility(View.GONE);
int position =
mDraggableView.getDragItemId();
GridPhoto mGridPhoto =
gridItemAdapter.getItem(position);
onGridPhotoDropped(mGridPhoto, 0);
}
else if(eventRecognition ==
DropCatchable.INSIDE_RIGHT)
{
findViewById(R.id.dragtxt).setVisibility(View.GONE);
int position =
mDraggableView.getDragItemId();
GridPhoto mGridPhoto =
gridItemAdapter.getItem(position);
onGridPhotoDropped(mGridPhoto,
gridItemAdapter.getCount());
}
draggableGallary.requestFocus();
draggableGrid.setSelection(-1);
// Log.e("from grid" , "to gallery " +
eventRecognition);
}
else if(dropCatchableViewID ==
R.id.gridViewDragDrop)
{
// Log.e("from grid" , "to grid " +
eventRecognition);
}
}
if(gallaryItemAdapter.isEmpty())
{
findViewById(R.id.dragtxt).setVisibility(View.VISIBLE);
gallaryItemAdapter.notifyDataSetChanged();
}
}
The selection always remains in the position (in gridview) from where the
item is recently dragged.
My problem is just in the case when I am dragging last item of the grid
view to the gallery,
as in that case the selection remains in the last position of the gridview
even after the removal of the the item.
I guess, my problem is somewhat clear to you, now.
Now, hoping for better results.
--
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