Reputation: 7105
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?
Upvotes: 0
Views: 1056
Reputation: 2704
You can pass the variable directly to the method or save it into a class variable and then use that
Upvotes: 1
Reputation: 2985
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
Upvotes: 3