I can hide the specific row, but i come back to the listview activity it will show again the specific row that I hide. Here is my code in below:
listView.setLongClickable(true);
listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
public boolean onItemLongClick(AdapterView<?> parent, final View v, final int position, long id) {
//Do your tasks here
textViewID = (TextView) v.findViewById(R.id.text_customerid);
custid = textViewID.getText().toString();
AlertDialog.Builder alert = new AlertDialog.Builder(
TableRecordActivity.this);
alert.setTitle("Alert!!");
alert.setMessage("Are you sure to delete record");
alert.setPositiveButton("YES", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//databaseHelper = new DatabaseHelper(getApplicationContext());
//sqLiteDatabase=databaseHelper.getReadableDatabase();
//databaseHelper.deleteCustomerInformation(custid,sqLiteDatabase);
LinearLayout parentLayout = (LinearLayout) v.findViewById(R.id.linearLayout);
parentLayout.setVisibility(View.GONE);
//Intent intent = new Intent(getApplication(),TableRecordActivity.class);
//intent.putExtra("user_id2",user_id2);
//intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
//startActivity(intent);
Toast.makeText(getApplicationContext(),"Customer deleted",Toast.LENGTH_LONG).show();
dialog.dismiss();
}
});
alert.setNegativeButton("NO", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
alert.show();
return true;
}
});