How do I make a OnClickListener in Java

Posted by Bob on Stack Overflow See other posts from Stack Overflow or by Bob
Published on 2014-06-11T01:42:33Z Indexed on 2014/06/11 3:25 UTC
Read the original article Hit count: 95

Filed under:

I used to program with html and to make a alert all I had to do was make an alert("Hello World"); but with java it is much more advanced. I need help to make a button that when someone clicks it, it has an alert message on the screen. This is my code right now:

MyOnClickListener onClickListener = new MyOnClickListener() {

    @Override
    public void onClick(View v) {

        Intent returnIntent = new Intent();
        returnIntent.putExtra("deleteAtIndex",idx);
        setResult(RESULT_OK, returnIntent);
        finish();

    }
};
for (int i =0;i<buttonList.size();i++) {
    buttonList.get(i).setText("Remove");
    buttonList.get(i).setOnClickListener(onClickListener);
}

© Stack Overflow or respective owner

Related posts about java