在Android中预加载活动? [英] Preload activity in Android?

查看:164
本文介绍了在Android中预加载活动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制作一个与iPhone应用程序配对的Android应用程序-两者都将使用WebView来处理其90%的内容.在两个平台上创建新的WebView所花费的时间都不为零-对于iPhone,我在用户点击任何内容之前 创建WebView取得了一些成功,然后在他们点击时将其添加到导航堆栈中做.

I am attempting to make an Android app that will be paired with an iPhone app - both of which will use WebViews for 90% of their content. Creating a new WebView on both platforms takes a non-zero amount of time - for the iPhone I've had some success creating a WebView before the user taps anything, then adding it to the navigation stack when they do.

我正在尝试使用Android进行同样的操作,但是活动"的概念阻碍了我的发展.看来我的WebView必须是一个Activity的一部分,并且如果该Activity不是当前显示在屏幕上的那个View,则无法渲染视图.是这样吗如果是这样,是否没有能力预加载WebView并然后将其插入到Activity中?

I'm trying to do the same with Android but the 'Activity' concept is holding me back. It appears that my WebView has to be part of an Activity, and I cannot render the view without that Activity being the one currently shown on screen. Is this the case? If so, is there no ability to preload a WebView and then insert it into an Activity?

推荐答案

在运行后台任务方面,尝试着比活动"更着重于服务"概念. Webview可以在服务中运行,并且该服务可以在Create()上加载

Try looking at the Service concept more than Activity for running background tasks. Webview can be run in a service and that service can be loaded onCreate()

一点点背景知识/类似问题

Little bit of background/ similar questions

http://developer.android.com/guide/components/services.html

Android:在活动上下文之外使用WebView (否定对最佳答案的评论不应影响您的问题)

Android: Using WebView outside an Activity context (The negative comments on the top answer shouldn't affect your question)

这篇关于在Android中预加载活动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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