On Thu, May 14, 2009 at 11:11 PM, idev <[email protected]> wrote:
> private void setCustomTitle(int value) {
> try {
> // retrieve value for
> com.android.internal.R.id.title_container
> int titleContainerId = (Integer) Class.forName(
> "com.android.internal.R$id").getField
> ("title_container").get(null);
>
> // remove all views from titleContainer
> ((ViewGroup) getWindow().findViewById
> (titleContainerId)).removeAllViews();
Good lord, DO NOT DO THIS. Do you see what you are doing? You are using
reflection to get at private information, and then using that information to
rip apart the system's decoration layout. You WILL break in the future. I
guarantee it.
Please, for me, slap whoever gave you this code.
And yes, this is how setFeatureInt() works. It would be nice to have it be
more flexible, but for now you need to set these things up before
setContentView(). If you want a changing title bar, you'll need to set your
own custom title bar view up-front and just manage it all yourself.
Okay now I am going to go cry silently in the corner.
--
Dianne Hackborn
Android framework engineer
[email protected]
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.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---