Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7815435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:31:16+00:00 2026-06-02T05:31:16+00:00

In the Gmail app, selecting an email from the left fragment opens the email

  • 0

In the Gmail app, selecting an email from the left fragment opens the email in the right fragment as normal. Rotating the device to portrait shows only the selected email, as you would expect, and rotating the device back to landscape shows both the email list and selected email again. That is all expected and works perfectly.

However, in the API demos and in my application based on the Fragments sample after selecting an item from the left fragment list and it being shown in the right hand fragment, a rotation of the device to portrait shows the list fragment instead of the selected item details fragment like in Gmail. Going back to landscape reveals the selected item again in the righthand fragment.

API Demos Sample code: http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/FragmentLayout.html

Any idea how i can recreate that shown in the Gmail app?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T05:31:18+00:00Added an answer on June 2, 2026 at 5:31 am

    Jon O pushed me in the right direction with his answer. Indeed on portrait, the XML only showed the list fragment:

    <?xml version="1.0" encoding="utf-8"?>
    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent" android:layout_height="match_parent">
    <fragment class="com.dixon.blah.Events$EventsListFragment"
            android:id="@+id/titles"
            android:layout_width="match_parent" android:layout_height="match_parent" />
    </FrameLayout>
    

    If i changed this to the details fragment however i get a FC as no item from the list has been selected yet. I got around this through placing the code below into my FragmentActivity onCreate method:

    if(detailsFrame != null) {
                Intent intent = new Intent();
                intent.setClass(this, EventDetailsActivity.class);
                intent.putExtra("index", mCurCheckPosition);
                intent.putExtra("id", mSelectedId);
                startActivity(intent);
    }
    

    Once an item in the list has been selected, the detailsFrame variable points to the View of the fragment. Thus from portrait rotation in the details fragment, to landscape and back again the View remains and is shown correctly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: How do you send email from a Java app using Gmail? How
If you open an app like gmail, and you compose a new email in
how to open gmail and send email to specific id ina android app? Intent
I am developing a Java app that reads all the emails from GMAIL and
I have a Groovy/Grails web app that reads e-mails from Gmail. It gets messages
I'm looking to copy the action bar implementation from the gmail app in Honeycomb
This screen was captured from Gmail app for android. The popup looks pretty cool
I am sending mail from my Java app to Gmail Account. I had used
I have a layout similar to the ICS Gmail app for tablets ( ListFragment
i'm trying to connect my app to Gmail to check emails. I must use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.