Android: using of menu button in tabgroup

You must Login before you can answer or comment on any questions.

Hi,

In my project I'am opening a (login-) window and after succcesfull login I'am opening a tabgroup. The tabgroup shows windows with measured values.

Now I'am looking for a possibility to open dailogbox ("Do you want logout?").

My idea: using of (hardware-) menu button.

  • in manual I can only read someting about android:back, android:home and android:search. Where is android:menu?

  • To which object I have to add EventListener? (T.App, tabGroup … ?)

Better ideas to solve my problem?

The code above doesnt work:

Ti.App.addEventListener('android:menu', function(e) {
    var dialog = Ti.UI.createAlertDialog({
        message : 'You want logout?',
        ok : 'OK',
        title : 'Logout'
    }).show();
});

Rainer

1 Answer

Rainer, I would hope you had checked the APIs located at docs.appcelerator.com particularly uder the Ti.Android.Menu section.

Using the example there, your 'window' is the tabgroup. I'm not going to write code for a Titan.

— answered 10 months ago by Stephen Feather
answer permalink
3 Comments
  • Android is not my favorite toy. But I'am learning. Thanx for your hint. Ia#m wondaring about this: altthough in my app no android event listeners, the app react after clicking of back or home button. Same if I write:

    Ti.App.addEventListener('android:back', function(e) { // or on myWindow.addEv...
        return false;
    });

    — commented 10 months ago by Rainer Schleevoigt

  • Hi,

    this is, what I not understand:

    tabGroup.addEventListener('android:back', function(e) {
        var dialog = Ti.UI.createAlertDialog({
            message : 'You want logout?',
            ok : 'OK',
            title : 'Logout'
        }).show();
        return false;
    });
    If Iclick on back-button, then the apps will be terminated.

    My goal: click shows the alert.

    Whats going wrong?

    Rainer

    — commented 10 months ago by Rainer Schleevoigt

  • See: http://developer.appcelerator.com/question/129626/androidback-on-tabgroup-not-firing

    It seems, tabgroup cannot listen to this event, only heavyweight windows can it.

    — commented 10 months ago by Rainer Schleevoigt

Your Answer

Think you can help? Login to answer this question!