Problems encountered by Biji (1)

Source: Internet
Author: User

In fact, it was not a long time ago, but now I want to record it. Go to the topic.

Currently, there are 4 fragment items, of which 3 are level-1 navigation items. The actionbar provides a list to access each fragment. The judgment is to write an internal class in mainactivity to implement onnavigationlistener. Because the fourth fragment enters from the third fragment by clicking list item, the problem is whether the actionbar is displayed or the navigation list, but when getactionbar () in the onresume method (), after setting the actionbar attribute and entering the fourth fragment, the title is normal. However, when the title bar is returned to the last level of fragment, It is not returned. This problem occurs because several fragment activities are parasitic on the same activity, and the actionbar is activity rather than fragment.

However, if onnavigationlistener is implemented in all fragment, it is too costly. Therefore, it is converted from an internal class to an external class, And fragmentmanager is transmitted for each fragment or activity. This reduces the number of duplicates.Code.

The problem occurs again.ProgramThe first fragment appears constantly in oncreate... The root cause is not found, so record it.

--------------------------------------------- 5/21 -------------------------------------------

The current idea of this problem may be that the first fragment is displayed by default because there is only one activity. However, onnavigationlistener is also set in this fragment, and the loop continues...

The solution has not been created yet. I want to write it again.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.