Code example for DragEvent

Methods: getActiongetLocalStategetResult

0
		textData = (TextView)findViewById(R.id.textView1);
	} 
 
	@Override 
    public boolean onDrag(View view, DragEvent dragEvent) {
        int dragAction = dragEvent.getAction();
        ListViewItem lView = (ListViewItem) view;
        ListViewItem dragView = (ListViewItem) dragEvent.getLocalState();
        if (dragAction == DragEvent.ACTION_DRAG_EXITED) {
            containsDragable = false;
        } else if (dragAction == DragEvent.ACTION_DRAG_ENTERED) {
            containsDragable = true;
        } else if (dragAction == DragEvent.ACTION_DRAG_ENDED) {
            if (dropEventNotHandled(dragEvent)) {
                dragView.setVisibility(View.VISIBLE);
            } 
        } else if (dragAction == DragEvent.ACTION_DROP && containsDragable) {
        	adapter.replace(lView.getData(), dragView.getData());
        } 
        return true; 
    } 
	 
	private boolean dropEventNotHandled(DragEvent dragEvent) {
		        return !dragEvent.getResult();
		} 
 
	@Override 
	public boolean onLongClick(View view) {
        ClipData clipData = ClipData.newPlainText("", "");
Stop searching for code, let great code find you!  Add Codota to your java IDE