In my application i am inflating a web view into a list view and have set long press click event to the web view. On long press i am duplicating a item to appear on the list view. as shown in the image.
I want to know the clicked item position so that i can make the duplicate view appear exactly above the clicked item, but now it appears on the first item in the list.
the item in grey is the duplicated item, i have clicked on the 10th item and it appears on the 1st item. how would i make it appear on the 10th item
![enter image description here][1]
wv.setOnLongClickListener(new OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
duplicateView.setVisibility(View.VISIBLE);
Log.d("lvsectionTwo "+lvsectionTwo.getScrollY(),"log");
WebView wv = (WebView) duplicateView.findViewById(R.id.wv1);
wv.loadData("item "+position, "text/html", null);
wv.setBackgroundColor(Color.DKGRAY);
![enter image description here][2]
return true;
}
});
return view;
}
Get the y position of view by:
http://developer.android.com/reference/android/view/View.html#getLocationInWindow%28int%5B%5D%29
it would require an array of integer of length 2
and x, and y co-ordinates would be stored in that array object, now use that object to get Position of view
private OnItemLongClickListener onlongpressed = new OnItemLongClickListener() {