Long click remove item from android listview : <p>What I should write in the <code>onItemLongClick</code> function to remove an item from the listview on long click. Below is the code:</p>

<pre><code>public class Favorites extends AppCompatActivity {

DBConnection db = new DBConnection(this);

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_favorites);

     ListView listView = (ListView) findViewById(R.id.empList);
     ArrayList&lt;String&gt; arrayList = db.getAllRecords();
     listView.setAdapter(new ArrayAdapter&lt;&gt;(this, android.R.layout.simple_list_item_1,arrayList));

    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
       @Override
        public boolean onItemLongClick(AdapterView&lt;?&gt; parent, View view,
                                        int position, long id) {



            return false;
        }
</code></pre>
