I am loading an image onto the screen and i want to be able to drag and drop that image into a part of a grid. I am not sure how to approach this? I have looked on the web but there isnt any good tutorials for dragging and dropping into a gridview. i understand the drop target is a gridview and that will need to accept a drop.
ImageView image = (ImageView) findViewById(R.id.image1);
image.setImageResource(R.drawable.gopher);
image.setOnLongClickListener(new OnLongClickListener(){
@Override
public boolean onLongClick(View v) {
return false;
}
});
I am ok with loading the image into a grid and then be able to move that image around that grid if thats easier way to go. However, as long as the loaded images dont look like there in a grid but i still see the sections of the grid for dropping.
Any help / direction is much appreciated.
I was looking for an drag and drop tutorial and came across this.
https://blahti.wordpress.com/2011/10/03/drag-drop-for-android-gridview/
I tried it out and it works. Note that it was written for Android 2.2 so it does not depend on the Drag and Drop framework in Android 3.0 and newer.
http://developer.android.com/guide/topics/ui/drag-drop.html