public class Notes extends AppCompatActivity {

    Button save;
    ArrayList<String> addArray = new ArrayList<String>();
    EditText txt;
    ListView show;


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

        txt = (EditText) findViewById(R.id.textInput);
        show = (ListView) findViewById(R.id.listView);
        save = (Button) findViewById(R.id.saveButton);

        final ArrayAdapter<String> adapter = new 
ArrayAdapter<String>(Notes.this, android.R.layout.simple_list_item_1, addArray);

        save.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                String getInput = txt.getText().toString();

                if (addArray.contains(getInput)) {
                    Toast.makeText(getBaseContext(), "Note already added!", 
Toast.LENGTH_LONG).show();
                } else if (getInput == null || getInput.trim().equals("")) {
                    Toast.makeText(getBaseContext(), "Input required!", 
Toast.LENGTH_LONG).show();
                } else {
                    addArray.add(getInput);

                    show.setAdapter(adapter);
                    ((EditText) findViewById(R.id.textInput)).setText(" ");
                }
            }
        });


        show.setOnItemLongClickListener(new 
AdapterView.OnItemLongClickListener() {
            @Override
            public boolean onItemLongClick(AdapterView<?> av, View v, int pos, 
long id) {






                return true;
            }
        });

    }


}




What would  I need to add to get the OnItemLongClickListener to delete 
specific items on the list view?
Thanks


-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/838730d0-9d4f-4e80-a5a8-e7bbf729aeb3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to