Android的表现发出─TabHost - 定时器 - SetCurrentTab() - 谷歌地图API V2 [英] Android Performance Issue- TabHost - Timer - SetCurrentTab() - Google Maps Api V2

查看:331
本文介绍了Android的表现发出─TabHost - 定时器 - SetCurrentTab() - 谷歌地图API V2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在标题说我已经有了一个性能问题在我的Andr​​oid应用程序。我有一个公共静态 tabhost 定时谷歌地图即可。计时器定于每3秒工作。根据我的的WebService 这是关系到数据库这是更新的东西。

As i said in title i 've got a performance issue on my Android application. I've got a public static tabhost and a timer and a Google Maps. Timer scheduled to work every 3 seconds. It 's updating something according to my WebService which is related to database.

例如,如果我的Web服务的回应等于1,那么我切换标签,否则为0 1。在这种情况下,当我切换到谷歌地图这是在选项卡1与此更新一切是确定的。 当第二个更新附带的0,我设置当前选项卡为0 的结果。在这个选项卡中,活动表现还算可以。然后我进入其中放置在该选项卡中的一切子活动是一次OK。 但是,当我试图要回去与后退按钮,它的成本我要3或4秒回(到标签0)

For example if my web service response equals to "1" then i'm switching tab 0 otherwise 1. In this case when i switch to google maps which is in tab 1 with this update everything is ok. When a second update came with a result of "0" i'm setting current tab to 0. In this tab, activity performance is ok. Then i entered subactivities which placed on this tab everything is ok again. But when i'm trying to go back with "Back" button it costs me for 3 or 4 seconds to go back (to tab 0)

这有什么错呢?

                    if(response.equals("1"))
                    {
                        if(CTSMainActivity.tabHost.getCurrentTab()!=0)
                            CTSMainActivity.tabHost.setCurrentTab(0);
                    }
                    else if(response.equals("0"))
                    {
                        if(CTSMainActivity.tabHost.getCurrentTab()!=1)
                            CTSMainActivity.tabHost.setCurrentTab(1);
                    }

任何帮助将AP preciated。

Any help will be appreciated.

编辑:

我GOOGLE了它和得到的东西。 我用DDMS方法分析工具,看到的 Android设备/部件/ Listview.measureHeightofChildren(IIII)我进程正在使用3.7秒。什么是它的解S?

I just googled for it and got something. I used DDMS method profiling tool and saw android/widget/Listview.measureHeightofChildren(IIII)I process is using 3.7 seconds. What 's the solution of it ?

编辑:

我还挺找到一个解决办法请点击此链接:<一个href=\"http://stackoverflow.com/questions/16263408/android-remove-google-maps-fragment-onpause-and-add-back-onresume\">Android - 移除谷歌地图片段的onPause并添加回onResume

I kinda find a solution please follow this link : Android - Remove Google Maps Fragment onPause and add back onResume

推荐答案

我已经解决了去除tabHost这个问题。并利用活动,新意图(); 请参阅以下网址:<一href=\"http://stackoverflow.com/questions/16263408/android-remove-google-maps-fragment-onpause-and-add-back-onresume\">Android - 移除谷歌地图片段的onPause并添加回onResume

I've solved this issue with removing tabHost. And using activities with new Intent(); Please refer this url : Android - Remove Google Maps Fragment onPause and add back onResume

这篇关于Android的表现发出─TabHost - 定时器 - SetCurrentTab() - 谷歌地图API V2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆