Deleting from base with ContextMenu
<p>So i am preety new with this SQLite i finaly managed to create base and work with it etc. Now i created ContextMenu thath you will be able to delete item from listView  on which context menu was opened. Here is my current code.</p>

<pre><code>import java.util.List;
import java.util.Random;

import android.app.ListActivity;
import android.os.Bundle;
import android.text.Editable;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.MenuInflater;
import android.view.View;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.Toast;
import android.view.MenuItem;

public class Ann extends ListActivity{
    private CommentsDataSource datasource;
    EditText edit;
    ListView bump;



    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.ann);

        datasource = new CommentsDataSource(this);
        datasource.open();      

        List&lt;Comment&gt; values = datasource.getAllComments();

        ArrayAdapter&lt;Comment&gt; adapter = new ArrayAdapter&lt;Comment&gt;(this,
                android.R.layout.simple_list_item_1, values);
        setListAdapter(adapter);
        registerForContextMenu(getListView());
    }


    public void onClick(View view) {
        @SuppressWarnings("unchecked")
        ArrayAdapter&lt;Comment&gt; adapter = (ArrayAdapter&lt;Comment&gt;) getListAdapter();
        Comment comment = null;
        switch (view.getId()) {
        case R.id.add:  
            edit = (EditText)findViewById(R.id.editTxt);            
            Editable txt=(Editable)edit.getText();
            String vnos = txt.toString();           
            comment = datasource.createComment(vnos);
            adapter.add(comment);
            edit.setText("");
            break;  
        }
        adapter.notifyDataSetChanged();
    }

    @Override
    public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo){
        super.onCreateContextMenu(menu, v, menuInfo);
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.context_menu, menu);
    }



    @Override
    protected void onResume() {
        datasource.open();
        super.onResume();
    }

    @Override
    protected void onPause() {
        datasource.close();
        super.onPause();
    }

}
</code></pre>

<p>Now i know thath i need to make method for <code>public boolean onContextItemSelected(MenuItem item)</code></p>

<p>but how to manage now to delete item which was selected.</p>
