Activity inside TabActivity doesn't work properly

by Edwin » Sat, 19 Feb 2011 18:43:16 GMT


Sponsored Links
 Hi All,

I have an activity named A which has TTS and service functions. It
works well if it is a single activity, but TTS and service are not
working if I put A into a TabActivity. I am not sure which part of the
program has problem. Maybe TabActivity have some effect for the
onActivityResult in A, thus TTS function not work.

Does anybody have idea to solve it?

Thanks

-- 



Re: Activity inside TabActivity doesn't work properly

by Zsolt Vasvari » Sat, 19 Feb 2011 19:54:44 GMT


 There are quite a few things wrong with Activities inside a
TabActivity.  Avoid them at all cost, if you can.  You should be able
to refactor your code to the point where they are not needed.




-- 


Sponsored Links


Re: Re: Activity inside TabActivity doesn't work properly

by Kwok Chun Wing, Edwin » Sat, 19 Feb 2011 23:51:36 GMT


 Should I put the onActivityResult in TabActivity instead of A activity? 
I really need them in the activity but I just want to put the acitivity 
inside a tab, so that I got problem.




There are quite a few things wrong with Activities inside a TabActivity. Avoid them at all cost, if you can. You should be able to refactor your code to the point where they are not needed.
Hi All, I have an activity named A which has TTS and service functions. It works well if it is a single activity, but TTS and service are not working if I put A into a TabActivity. I am not sure which part of the program has problem. Maybe TabActivity have some effect for the onActivityResult in A, thus TTS function not work. Does anybody have idea to solve it? Thanks
--



Re: Re: Activity inside TabActivity doesn't work properly

by Justin Anderson » Sun, 20 Feb 2011 07:50:09 GMT


 I have yet to hear of an example where someone was able to successfully put
activities inside a TabActivity.  Why it is allowed I'm not sure... The most
success comes from having a single activity and having each tab be a
different View...

On Sat, Feb 19, 2011 at 8:51 AM, Kwok Chun Wing, Edwin






-- 



Re: Re: Activity inside TabActivity doesn't work properly

by Dianne Hackborn » Sun, 20 Feb 2011 11:05:03 GMT


 Contacts is implemented like this.  At least it was a while ago, I don't
know if that is still the case.

Still, yes,  embedded activities it pretty cruddy.  One of the goals of
Fragment is to provide a better solution to replace it.

(For some perspective on where embedded activities came from -- early UI
designs for Android were very tab-oriented, and we were looking at tabs as
one of the extension points for applications, allowing the tabs to host
activities from other applications.  Ultimately though the UI moved away
from that, and we thus never implemented the (complicated) support for
cross-process embedded activities and probably never will.  So embedded
activities uses the heavy-weight activity abstraction on the theory that the
activities you host could be in separate processes, when they actually
can't.  Fragments provide a better API because they drop the pretense of
these things being so separate.)










-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 



Re: Activity inside TabActivity doesn't work properly

by ggjProjects » Fri, 20 May 2011 09:34:05 GMT


 Hi Edwin,

  Try to change:

   voice = new TextToSpeech(*this*, this);

  to: 

   voice = new TextToSpeech(*this.getParent()*, this);

  Hope this helps.

-- 



Other Threads

1. How to register for SMS database changes

Hi,

How can I register for SMS database changes?

I tried:
mCursor = mActivity.getContentResolver().query(Sms.CONTENT_URI, new String[] {
                Sms.ADDRESS
        }, null, null, null);


 mCursor.registerDataSetObserver(mydataSetObserver);

where mydataSetObserver is implemented like this:
  private class MyDataSetObserver extends DataSetObserver {
        public void onChanged() {
            System.out.println ("1");
        }
        public void onInvalidated() {
             System.out.println ("2");
        }
}

But when I tried sending a SMS message in the emulator,
MyDataSetObserver never get called.

Can you please tell me why?

Thank you.

--~--~---------~--~----~------------~-------~--~----~

2. ScrollView vs. android:scrollbarAlwaysDrawVerticalTrack

Hi,

maybe this is a beginners question, but its not about SDK setup, so in
this group.
I'm developing since Months, and now - finetuning the app, I am stuck
with scrolling.
However.

If you know a good howto about scrolling , post it and your're done ;)
If not please read below.

The class View has multiple scrolling-related properties, so each
subclass is actually aware of scrolling.
So - in theory - there should be no need to introduce special Views
like HorizontalScollView and ScrollView, right? Besides convenience,
of course.
<LinearLayout>
   <some fixed size Views>
   <ViewFlipper>
       <RelativeLayout>   <<-- not necessarilty, any working thing
would do.
           <my Child, extending View/>      <<-- may be large in x and
y (sizing also at runtime dynamically, as will change the size for
zooming)
       </RelativeLayout>
   </ViewFlipper>
</LinearLayout>



My Question is very simple:
How can I put a large child into a smaller parent, exceeding X and Y
without cutting the child?    *)



Which attributes have to be set how?

I am currently using ScrollView inside a  HorizontalScrollView, which
does not support x&y scrolling at the same time.

I'd expect the built-in scroll features to be activated, when a child
view gets larger, than the parent allows.
But where do the attributes have to be set?
On the most-inner "scroller" or the most-outer "scrollee"?

Are the scroll related drawables a must to be used, or just in case I
want special-looking scroll bars?

Very-most attempts failed to show scrollbars at all, only using the
dedicated classes worked.
Is the build-in scrolling related to layout_width and layout_height
attribute values fill_parent and wrap_content?

Does it matter for a common application (no widget) that the classes
reside in the widget subpackage? It works, but is it intended to be
used that way?

Thanks & best regards,
Flo

*) good to know that software guys understand this sentence different
than the rest of the world....

--~--~---------~--~----~------------~-------~--~----~

3. Good News for indonesia Perfected SPL..

4. Sample Code missing

5. SQL Server Connection

6. surfaceview in a frame layout

7. Android Dialer