• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Calling a function from within an AlertDialog?

icydash

Newbie
Is there a way to call a function from within an AlertDialog (like calling addUser in the following code):

Code:
AlertDialog.Builder builder = new AlertDialog.Builder(uNear.this);
              builder.setMessage("Select an Option")
                     .setPositiveButton("User Information", new DialogInterface.OnClickListener() {
                         public void onClick(DialogInterface dialog, int id) {
                             addUser();
                         }
                     })
....

public void addUser(View view) {
//etc
}

Thanks!

EDIT: Never mind, got it. I had to get rid of the "View view" and then it worked.
 
Back
Top Bottom