Q:

accessing variable in a method to another method in same class

Hi i have used to a input dialog using a material design library to get a value.
inside the save button i have put my input dialog
saveButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                new MaterialDialog.Builder(getActivity())
                        .title("Please enter your playlist name")
                        .inputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_DATETIME_VARIATION_NORMAL)
                        .input("", "", new MaterialDialog.InputCallback() {
                            @Override
                            public void onInput(MaterialDialog dialog, CharSequence input) {

                                new BackgroundTask().execute();
                            }
                        }).show();

            }
        });

here i want to get the 'input' variable in
 public void onInput(MaterialDialog dialog, CharSequence input) {

to use in another method. How can i access this variable?

A:

If I understood your question well, you could get the input value like this:
private inputVal;

.... 
@Override
public void onInput(MaterialDialog dialog, CharSequence input) {
   //save the input variable to a global variable to be able to use it later
   inputVal = input.toString();
   new BackgroundTask().execute();
}

And then you could easily use the input variable in other methods

