如果所有数据都来自服务器端,Android Phonegap 应用程序将重新启动
在我的phonegap应用程序中,所有内容都来自服务器端(例如HTML/JS/CSS以及phonegap-1.0.0.js),因为我的应用程序中包含PHP脚本。并从我的phonegap应用程序加载web-url例如:
package com.test;
导入 com.phonegap.*;
public class TestActivity extends DroidGap {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.setBooleanProperty("loadInWebView", true);
super.loadUrl("http://somewebsite/index.html");
//ORIGINAL--> super.loadUrl("file:///android_asset/www/index.html");
}
}
现在,此应用程序的问题是当屏幕方向更改或从我们的应用程序重新启动应用程序使用相机功能时。
请帮助我并回复这篇文章的答案
谢谢, 尼勒什
In my phonegap application everything to come from server-side (e.g HTML/JS/CSS also phonegap-1.0.0.js) because of in my application include PHP Script. and load web-url from my phonegap application For example:
package com.test;
import com.phonegap.*;
public class TestActivity extends DroidGap {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.setBooleanProperty("loadInWebView", true);
super.loadUrl("http://somewebsite/index.html");
//ORIGINAL--> super.loadUrl("file:///android_asset/www/index.html");
}
}
Now problem with this application is when screen orientation change or camera functionality use from our application restart application.
please help me and reply answer on this post
Thanks,
Nilesh
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在活动标记内的清单中修复活动的方向:
这也可能会解决相机问题。
另一件事:如果您不使用 PhoneGap 功能(没有本机访问,没有钩子,客户端没有 PhoneGap java 脚本),那么您可能会更好地使用具有 WebView 作为内容视图的 Activity。这样你的应用程序会更轻,并且你可以更好地控制内容加载(你可以将上次访问的 URL 保存在 SharedPreferences 中,并在 onResume() 中加载它,你可以实现用户、会话和 cookie 管理等)
You can fix the orientation of your Activity in the manifest inside the activity tag:
This will probably fix the camera issue too.
The other thing: if you don't use PhoneGap functionality (no native access, no hooks, no PhoneGap java scripting on client side) then you'll probably be better off with your Activity that has a WebView as it's content view. This way your application will be lighter and you will have more control over the content loading (you could save the last visited URL in SharedPreferences, and load it in onResume(), you clould implement user, session and cookie management etc.)