Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-3130] Android: Provide API for a TabGroup/Heavywindows/All activities in order to catch events

GitHub Issuen/a
TypeNew Feature
PriorityLow
StatusClosed
ResolutionInvalid
Resolution Date2017-06-13T20:28:30.000+0000
Affected Version/sRelease 1.8.2
Fix Version/sRelease 1.7.0, Sprint 2011-12
ComponentsAndroid
LabelsSupportTeam, klist
ReporterMarshall Culpepper
AssigneeEric Merriman
Created2011-04-15T03:37:40.000+0000
Updated2017-06-13T20:28:33.000+0000

Description

There currently isn't a way to access the Activity object for a TabGroup

HD Discussion

http://support-admin.appcelerator.com/display/16135

Comments

  1. Dawson Toth 2011-04-15

    I believe I have a workaround.

    Workaround

    If you wait for one of the tab group's windows to open, you can use Ti.Android.currentActivity to get at the tab group's activity. For example:

       var tabGroup = Ti.UI.createTabGroup();
       var tmpWindow = Ti.UI.createWindow();
       tabGroup.addTab(Ti.UI.createTab({ window: tmpWindow }));
       tabGroup.addTab(Ti.UI.createTab({ window: Ti.UI.createWindow() }));
       tabGroup.open();
       
       tmpWindow.addEventListener('open', function() {
           Ti.Android.currentActivity.addEventListener('restart', function() {
               alert('Restarted!');
           });
           alert('Opened!');
       });
       

    In this sample, "Ti.Android.currentActivity" properly adds the event listener to the tab group's activity, and allows the "restart" event to be handled.

    That having been said, it would be nice to be able to do tabGroup.activity like we can do window.activity.

    Associated Helpdesk Ticket

    http://developer.appcelerator.com/helpdesk/view/73401">http://developer.appcelerator.com/helpdesk/view/73401

  2. Opie Cyrus 2011-04-15

    Currently, this feature is not possible due to the kind of activity that the Tab group represents. That said, a feature request will be opened for accessing activity from the tab itself (tab.activity).

    The work around that Dawson shows above set the event listener on the currently active and open tab and is the suggested method for handling this situation. As the activity changes when the tab changes, the callback needs to be set again on Ti.Android.currentActivity when the tab changes. You should also be able to set the listeners on Ti.Android.currentActivity the first time each tab opens which would negate having to set the listeners again if when the tab was selected subsequent times.

    #3415 spawned for feature request

  3. Mauro Parra-Miranda 2012-04-19

    Hello, I provided Dawson's workaround to the customer, but some of the events are not working properly. The customer needs to catch all the events all activities, including tabs, heavy windows and such. BEst, Mauro
  4. Lee Morris 2017-06-13

    Closing ticket due to the time passed and lack of progress. Any problems, please file a new ticket.

JSON Source