Reading your question, and with Honeycomb being relatively new, I
thought perhaps I had seriously screwed up how that "home affordance"
worked. Hence, I'm grateful that this is working for you.

On Sun, Jun 5, 2011 at 2:32 PM, Christer Nordvik <[email protected]> wrote:
> That's what I get for coding at night. I had forgotten that I had
> created my own base activity that had implemented starting a new
> Intent and no finish call.
>
> Sorry about that, and thanks for responding :-)
>
> -Christer
>
> On Jun 5, 1:31 am, Mark Murphy <[email protected]> wrote:
>> AFAIK, the top left icon has no effect, other than whatever effect you
>> apply yourself. Just marking it as "up enabled" does not cause Android
>> to somehow magically know how to handle that. Instead, you have to
>> override onOptionsItemSelected() and watch for android.R.id.home and
>> do something there.
>>
>> For example, in one of my activities that uses
>> setDisplayHomeAsUpEnabled(), I have:
>>
>>         @Override
>>         public boolean onOptionsItemSelected(MenuItem item) {
>>                 switch (item.getItemId()) {
>>                         case android.R.id.home:
>>                                 finish();
>>
>>                                 return(true);
>>                 }
>>
>>                 return(super.onOptionsItemSelected(item));
>>         }
>>
>> In this case, the flow is much like yours -- "up" equates to "back",
>> so I just finish() the current activity to make it happen.
>>
>> If you are using startActivity() with FLAG_ACTIVITY_REORDER_TO_FRONT
>> to go "home", that's not going to immediately destroy your original
>> activity, any more than any other startActivity() call does.
>>
>> So... what are you doing in onOptionsItemSelected()?
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On Sat, Jun 4, 2011 at 7:22 PM, Christer Nordvik <[email protected]> wrote:
>> > I have two activities.
>>
>> > 1. Home
>> > 2. Details
>>
>> > In the details activity I set:
>> >  ActionBar actionBar = this.getActionBar();
>> >  actionBar.setDisplayHomeAsUpEnabled(true);
>>
>> > and this causes the top left icon to act as a home button.
>>
>> > But what I hadn't anticipated was that the details activity isn't
>> > destroyed when pressing the home button. If I press the back button
>> > then the activity is destroyed.
>>
>> > Can anyone explain why the details activity isn't destroyed? Do I need
>> > to intercept the user clicking the home button and destroy the
>> > activity myself since I want to cleanup the image resources it uses...
>>
>> > --
>> > 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
>>
>> --
>> Mark Murphy (a Commons 
>> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>>
>> _The Busy Coder's Guide to Android Development_ Version 3.6 Available!
>
> --
> 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
>



-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android 3.0 Programming Books: http://commonsware.com/books

-- 
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

Reply via email to