broadcastreceiver - Android send data from different activities managed by a TabHost (that has custom TabWidgets) -
broadcastreceiver - Android send data from different activities managed by a TabHost (that has custom TabWidgets) -
i'm having problem communicating between activities managed tabhost. problem this:
there main class extends tabactivity; in tabhost 4 screens;the 4 screens 4 different activities, managed tabhost :
private void setupscreen1{ intent.setclass(this, class1.class); tabhost.tabspec spec = tabhost.newtabspec("a1") .setindicator(getstring(r.string.week_view), getresources().getdrawable(r.drawable.icon1)) .setcontent(intent); tabhost.addtab(spec); }
from screen1 need alter tabhost's currenttab screen2 , send info screen2. to have 2 broadcastreceivers. --> 1 sent intent main class switch tab (in onreceive() : setcurrenttab(intent.getintextra(data, -1));
--> other 1 sent info screen2 : screen2 uses info in oncreate()
title; in screen2.oncreate() there broadcastreveiver listenes info used title the problem : first time tabhost switches screen2 info not sent because broadcastreciver has not been registed yet (since screen2.oncreate() called). after seems work ok every time.
does know how work around problem ?
android broadcastreceiver android-tabhost android-intent
Comments
Post a Comment