Camera and Baidu map in Tabactivity, switching to each other leading to the display of disorder problem solving

Source: Internet
Author: User

Today encountered a wonderful problem, an app's big frame is the following four tab page, so I used the tabactivity, of which two tab pages are sweep sweep and Baidu map activity. The problem comes, if you click the tab page into the camera, the scan is normal, but then click on the map, the entire map will not show. On the contrary, advanced to Baidu Map, and then into the camera, is the same problem, only the map is covered on the above, the camera preview in the following show does not come out.

Examples are as follows:



After my home analysis, the reason that the camera used Surfaceview as a preview vector, Surfaceview has the feature of Preemption window, he is not a view in essence. So it can be speculated that Baidu map Mapview is similar to a thing, when two live in a tabactivity, switching to each other will lead to the above problems. There are 2 ways to solve this problem:

1, is the camera preview carrier transposition Texttureview, should be OK!

2, do not put the camera and Baidu map in a tab, let one of the direct start by tabactivity. At this time into the scan, and tabactivity relationship, Baidu Map How to switch also do not affect.

The relevant code is as follows:

Case R.id.radiobtn_2:
Gotomipcaactivitycapture ();
Radiobtn_2.setchecked (FALSE);
This.mHost.setCurrentTabByTag (TAB2);
Break

In addition, because the click Scan, tag is not set down, to add a tag according to the host to update the function of the tags icon, in the Onresume call:

private void Updatetabiconbytag () {
String Currtag = Mhost.getcurrenttabtag ();
if (Currtag.equals (TAB1)) {
Radiobtn_1.setchecked (TRUE);
}else if (currtag.equals (TAB3)) {
Radiobtn_3.setchecked (TRUE);
}else if (currtag.equals (TAB4)) {
Radiobtn_4.setchecked (TRUE);
}
}


Hurry up and write so much.

Camera and Baidu map in Tabactivity, switching to each other leading to the display of disorder problem solving

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.