Context Menu for ListView
<p>I have a <code>ListView</code> with a customized adapter in my application. I want to add a <code>ContextMenu</code> for deleting items in this <code>ListView</code> </p>

<p>in my <code>onCreate</code> method I register the <code>Context Menu</code>:</p>

<pre><code>registerForContextMenu(lastCases);
</code></pre>

<p>where the parameter is my ListView</p>

<p>This should call this method: </p>

<pre><code>@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    Log.i("onCreateContextMenu: ", "Inside"); 
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.stock_file_menu, menu);
}
</code></pre>

<p>As you can see I use the Logger to log info whenever this method is called. But it doesn't outputs anything to <code>LogCat</code>, which indicates that this method is never fired off.</p>

<p>Also I should mention that my <code>ListView</code> is filled with information from this method: </p>

<pre><code>private void RefreshCaseList() {

    lastTenCases = db.getAllCases(10);
    if (lastTenCases.size() &gt; 0)
        error.setText("");

    lastCases.setAdapter(new CustomAdapter(myClass.this, lastTenCases));

}
</code></pre>

<p>This method grabs some objects from a database, and fills the <code>ListView</code> with these objects, but this method is called before I register the <code>context menu</code> in <code>OnCreate</code>. </p>

<p>No errors does occure so I doesn't have any more information that can help me. Anybody how knows how to make a <code>Context Menu</code> for a <code>ListView</code> with a customized adapter? </p>

<p>Thanks in advance!</p>
