Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InputDialog strange log #1

Closed
azizkayumov opened this issue Feb 15, 2017 · 8 comments
Closed

InputDialog strange log #1

azizkayumov opened this issue Feb 15, 2017 · 8 comments
Labels

Comments

@azizkayumov
Copy link

I have tried this for simple name input:

SimpleInputDialog.build()
              .msg(getString(R.string.enter_flashcard_name))
              .inputType(InputType.TYPE_CLASS_TEXT)
              .show(MainActivity.this);

But in logcat, it gives this:

I/TextInputLayout: EditText added is not a TextInputEditText. Please switch to using that class instead. and it makes me nervous, what the hell did I do wrong?

@eltos
Copy link
Owner

eltos commented Feb 15, 2017

Am I right that this is just a warning and the dialog still behaves as expected?

@eltos
Copy link
Owner

eltos commented Feb 15, 2017

It's probably because I am using an AutoCompleteTextView (which is a subclass of EditText) rather than TextInputEditText.
Unfortunately there is no aquivalent in the support library, so I'd have to make my own implementation of it. It seems to be straightforward though.

See http://stackoverflow.com/a/41864063/4961701

@eltos
Copy link
Owner

eltos commented Feb 15, 2017

By the way, TYPE_CLASS_TEXT is the default InputType, no need to explicitly set it ;)

@azizkayumov
Copy link
Author

But there is nothing on onResult, it is not giving me the entered text by user, it just shows the log, that's it!

@azizkayumov
Copy link
Author

The dialog still behaves as expected, but there is NO result, without result, it is just a dialog which user can enter some text, but you can't deal with the text

@eltos
Copy link
Owner

eltos commented Feb 15, 2017

I see. Well that's because you have called the show method without a tag.
A tag is required to receive results, so that you can match the results from different dialogs in the onResult method. Even if there is only one dialog in an activity, a tag has to be supplied, otherwise onResult will never get called! (I probably should point that out in the docs; sorry I'm still working on that wiki)

Try this:

final static String FLASHCARD_DIALOG = "flashcard_dialog_tag";
SimpleInputDialog.build()
                 .msg(R.string.enter_flashcard_name)
                 .show(MainActivity.this, FLASHCARD_DIALOG);
@Override
public boolean onResult(@NonNull String dialogTag, int which, @NonNull Bundle extras) {
    if (FLASHCARD_DIALOG.equals(dialogTag) && which == BUTTON_POSITIVE){
        String name = extras.getString(SimpleInputDialog.TEXT);
        // ...
        return true;
    }
    return false;
}

@eltos eltos added the invalid label Feb 15, 2017
@eltos eltos closed this as completed Feb 16, 2017
@azizkayumov
Copy link
Author

Thanks Eltos, I did this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants