Well initially, I have a list that shows all my comments, which is my problem.
I want only the owner of the photo to be able to delete the comments that are in the photo.
Someone has some idea.
here's my code:
public void deleteComment () {
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, final View view, final int position, long id) {
view.setSelected(true);
listView.setBackgroundResource(0);
view.setBackgroundResource(R.color.accent_material_light);
in = position;
AlertDialog.Builder dialog = new AlertDialog.Builder(ComentarActivity.this);
dialog.setTitle( "Deletar" );
dialog.setMessage( "Tem certeza, que deseja apagar este comentario?" );
dialog.setCancelable( false );
dialog.setNegativeButton( "Não",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int which) {
excluir();
}
} );
dialog.setPositiveButton( "Sim",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
mostrarUM.remove(in);
ArrayAdapter adapter = new ArrayAdapter(
ComentarActivity.this,
android.R.layout.simple_list_item_1,
mostrarUM);
listView.setAdapter(adapter);
}
} );
dialog.create();
dialog.show();