的指定行我可以隱藏特定行,但我回來到ListView活動將再次顯示特定行,我躲起來。這裏是我的代碼如下:如何隱藏特定行,當我點擊刪除列表視圖
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;
}
});