在Android上工作灯应用程序启动画面

在Android上工作灯应用程序启动画面

本文介绍了在Android上工作灯应用程序启动画面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的工作灯的Andr​​oid应用程序,

当我尝试添加一个启动画面

 公共类MyApp的扩展WLDroidGap {
    @覆盖
    公共无效的onCreate(包savedInstanceState){
       super.onCreate(savedInstanceState);
       super.setIntegerProperty(启动画面,R.drawable.splash);
       super.loadUrl(getWebMainFilePath(),2000);
    }
}
 

我看到启动画面,但后来,我有一个黑色的屏幕和应用程序崩溃是准确的,它显示黑屏,当我点击上的选项按钮,它崩溃

当我删除了2000

 公共类MyApp的扩展WLDroidGap {
    @覆盖
    公共无效的onCreate(包savedInstanceState){
       super.onCreate(savedInstanceState);
       super.setIntegerProperty(启动画面,R.drawable.splash);
       super.loadUrl(getWebMainFilePath());
    }
}
 

我没有看到启动画面,以及应用程序的工作原理。

我看到有人在IBM论坛上谈到了

和有许多博客文章谈论splashsccreens为Android与PhoneGap的这里和的,但我没有看到这些帖子解决我的问题。

下面是应用程序日志中崩溃后:

  I / SurfaceFlinger(93):[SurfaceFlinger]框:2,时间:2.262000,FPS:0.883908
I / InputDispatcher(246):渠道426b7be0导航栏(服务器)'〜finishDispatchCycle  - 因为事件4.8ms,因为调度3.0ms,办理=真
E / AndroidRuntime(15615):致命异常:主要
E / AndroidRuntime(15615):显示java.lang.NullPointerException
E / AndroidRuntime(15615):在com.worklight.androidgap.WLDroidGap.on prepareOptionsMenu(WLDroidGap.java:163)
E / AndroidRuntime(15615):在com.worklight.androidgap.WLDroidGap.onCreateOptionsMenu(WLDroidGap.java:159)
E / AndroidRuntime(15615):在android.app.Activity.onCreatePanelMenu(Activity.java:2458)
E / AndroidRuntime(15615):在com.android.internal.policy.impl.PhoneWindow preparePanel(PhoneWindow.java:389)。
E / AndroidRuntime(15615):在com.android.internal.policy.impl.PhoneWindow.onKeyDownPanel(PhoneWindow.java:770)
E / AndroidRuntime(15615):在com.android.internal.policy.impl.PhoneWindow.onKeyDown(PhoneWindow.java:1435)
E / AndroidRuntime(15615):在com.android.internal.policy.impl.PhoneWindow $ DecorView.dispatchKeyEvent(PhoneWindow.java:1824)
E / AndroidRuntime(15615):在android.view.ViewRootImpl.deliverKeyEventPostIme(ViewRootImpl.java:3492)
E / AndroidRuntime(15615):在android.view.ViewRootImpl.handleFinishedEvent(ViewRootImpl.java:3464)
E / AndroidRuntime(15615):在android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2601)
E / AndroidRuntime(15615):在android.os.Handler.dispatchMessage(Handler.java:99)
E / AndroidRuntime(15615):在android.os.Looper.loop(Looper.java:137)
E / AndroidRuntime(15615):在android.app.ActivityThread.main(ActivityThread.java:4524)
E / AndroidRuntime(15615):在java.lang.reflect.Method.invokeNative(本机方法)
E / AndroidRuntime(15615):在java.lang.reflect.Method.invoke(Method.java:511)
E / AndroidRuntime(15615):在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:809)
E / AndroidRuntime(15615):在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576)
E / AndroidRuntime(15615):在dalvik.system.NativeStart.main(本机方法)
 

解决方案

如果您在工作灯5.0.5.x试试这个:

 公共无效的onCreate(包savedInstanceState){
    super.onCreate(savedInstanceState);
    super.loadUrl(getWebMainFilePath()); //是的,这是一个额外的调用
    super.setIntegerProperty(启动画面,R.drawable.splash);
    super.loadUrl(getWebMainFilePath(),5000);
}
 

如果您在工作灯5.0.6.x试试这个:

 公共无效的onCreate(包savedInstanceState){
    super.onCreate(savedInstanceState);
    super.setIntegerProperty(启动画面,R.drawable.splash);
    super.bindBrowser(appView);
    super.loadUrl(getWebMainFilePath(),5000);
}
 

I am using Worklight for an Android application,

When I try to add a splash screen

public class MyApp extends WLDroidGap {
    @Override
    public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       super.setIntegerProperty("splashscreen", R.drawable.splash);
       super.loadUrl(getWebMainFilePath(),2000);
    }
}

I see the splash screen, but then, I have a black screen and the app crashesto be accurate, it shows a black screen, and when I tap on options button, it crashes

When I remove the ",2000"

public class MyApp extends WLDroidGap {
    @Override
    public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       super.setIntegerProperty("splashscreen", R.drawable.splash);
       super.loadUrl(getWebMainFilePath());
    }
}

I don't see the splash screen, and the app works.

I see that someone talked about that in IBM forums

And there are many blog posts talking about splashsccreens for Android with PhoneGaphere and here, but I dont see a solution in these posts to my problem

Here are the app log after the crash:

I/SurfaceFlinger(   93): [SurfaceFlinger] frames:2, duration:2.262000, fps:0.883908
I/InputDispatcher(  246): channel '426b7be0 NavigationBar (server)' ~ finishDispatchCycle - 4.8ms since event, 3.0ms since dispatch, handled=true
E/AndroidRuntime(15615): FATAL EXCEPTION: main
E/AndroidRuntime(15615): java.lang.NullPointerException
E/AndroidRuntime(15615):    at com.worklight.androidgap.WLDroidGap.onPrepareOptionsMenu(WLDroidGap.java:163)
E/AndroidRuntime(15615):    at com.worklight.androidgap.WLDroidGap.onCreateOptionsMenu(WLDroidGap.java:159)
E/AndroidRuntime(15615):    at android.app.Activity.onCreatePanelMenu(Activity.java:2458)
E/AndroidRuntime(15615):    at com.android.internal.policy.impl.PhoneWindow.preparePanel(PhoneWindow.java:389)
E/AndroidRuntime(15615):    at com.android.internal.policy.impl.PhoneWindow.onKeyDownPanel(PhoneWindow.java:770)
E/AndroidRuntime(15615):    at com.android.internal.policy.impl.PhoneWindow.onKeyDown(PhoneWindow.java:1435)
E/AndroidRuntime(15615):    at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1824)
E/AndroidRuntime(15615):    at android.view.ViewRootImpl.deliverKeyEventPostIme(ViewRootImpl.java:3492)
E/AndroidRuntime(15615):    at android.view.ViewRootImpl.handleFinishedEvent(ViewRootImpl.java:3464)
E/AndroidRuntime(15615):    at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2601)
E/AndroidRuntime(15615):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(15615):    at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(15615):    at android.app.ActivityThread.main(ActivityThread.java:4524)
E/AndroidRuntime(15615):    at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(15615):    at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(15615):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:809)
E/AndroidRuntime(15615):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576)
E/AndroidRuntime(15615):    at dalvik.system.NativeStart.main(Native Method)
解决方案

If you are on Worklight 5.0.5.x try this:

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    super.loadUrl(getWebMainFilePath());  // yes, this is an extra invocation
    super.setIntegerProperty("splashscreen", R.drawable.splash);
    super.loadUrl(getWebMainFilePath(), 5000);
}

If you are on Worklight 5.0.6.x try this:

public void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    super.setIntegerProperty("splashscreen", R.drawable.splash);
    super.bindBrowser(appView);
    super.loadUrl(getWebMainFilePath(), 5000);
}

这篇关于在Android上工作灯应用程序启动画面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 14:34