Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2038] Android: Use addView in TiUIDialog to add option input box to alert

GitHub Issuen/a
TypeNew Feature
PriorityTrivial
StatusClosed
ResolutionDuplicate
Resolution Date2011-04-15T03:08:47.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.6.0 M10
ComponentsAndroid
Labelsandroid, dialog, feature, input, release-1.6.0
ReporterRalf Pfeiffer
AssigneeDon Thorp
Created2011-04-15T03:08:46.000+0000
Updated2017-03-03T05:47:46.000+0000

Description

Add the possibility of a text box inside of an alert dialog to catch user input? Code sample below...

if (d.containsKey("hasInput")) {
    if (TiConvert.toBoolean(d, "hasInput")) {
        Activity currentActivity = proxy.getTiContext().getTiApp().getCurrentActivity();
        if (currentActivity == null) {
            currentActivity = proxy.getTiContext().getActivity();
        }
        EditText input = new EditText(currentActivity);
        builder.addView(input);
    }
}

This code was written theoretically, but should show the gist of it. Possibly a new proxy such as Ti.UI.createInputDialog() should be created for this?

I.e, Ti.UI.createInputDialog({title: 'Hello', message: 'What is your name?' hasInput: true}) would show us a standard dialog, only with a text input attached. This would also need to be catered to in the fireEvent in order to extract the text.

Theoretical code:

var input = Ti.UI.createInputDialog({title: 'Hello', message: 'What is your name?' hasInput: true});

input.addEventListener('click', function(e) {
    alert(e.textValue); // made up return value
});

Andrew

Comments

  1. Stephen Tramer 2011-04-15

    Assigning to Don for triage.

    Worth noting that iOS CANNOT support this feature due to the HIG guidelines and dialog/error interfaces.

  2. Don Thorp 2011-04-15

    Android dialog already supports adding a view. It was added in 1.5.0.

  3. Lee Morris 2017-03-03

    Closing issue due to time passed and irrelevance of the ticket.

JSON Source