Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/382.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在Android上按home按钮-恢复应用程序时显示白色屏幕_Java_Android_Cordova_Android Activity - Fatal编程技术网

Java 在Android上按home按钮-恢复应用程序时显示白色屏幕

Java 在Android上按home按钮-恢复应用程序时显示白色屏幕,java,android,cordova,android-activity,Java,Android,Cordova,Android Activity,我正在使用phonegap创建一个Android应用程序。每当我在应用程序中按下home(主页)按钮,然后尝试重新打开应用程序时,我会看到一个白色的空白屏幕,只有在触摸屏幕时才会消失。 在logcat中,我触摸屏幕后收到一条消息,说blockWebkitDraw lockedfalse 如果我按下“后退”按钮退出应用程序,然后返回-它工作正常,所以我真的不确定为什么“主页”按钮不工作 这是我在清单中的活动: <activity android:name=".PhoneGapActivity

我正在使用phonegap创建一个Android应用程序。每当我在应用程序中按下home(主页)按钮,然后尝试重新打开应用程序时,我会看到一个白色的空白屏幕,只有在触摸屏幕时才会消失。 在logcat中,我触摸屏幕后收到一条消息,说blockWebkitDraw lockedfalse

如果我按下“后退”按钮退出应用程序,然后返回-它工作正常,所以我真的不确定为什么“主页”按钮不工作

这是我在清单中的活动:

<activity android:name=".PhoneGapActivity" android:launchMode="singleTop" android:configChanges="orientation|keyboardHidden|screenLayout|screenSize">
        <intent-filter>
            <action android:name="com.matt.android.theAppName.MESSAGE"/>
            <category android:name="android.intent.category.DEFAULT"/>
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
但这会使活动重新启动—这并不理想

如果有人知道这是为什么,我真的非常感谢任何意见,谢谢

编辑:

onCreate方法:

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Log.d(TAG, "onCreate");

    int splashImageResourceIdentifier = getResources().getIdentifier("splash", "drawable", getPackageName());
    if (splashImageResourceIdentifier != 0) {
        super.setIntegerProperty("splashscreen", splashImageResourceIdentifier);
        super.loadUrl(WORK_DIR + getStartFileName(), 10000);
    } else {
        super.loadUrl(WORK_DIR + getStartFileName());
    }

    super.setIntegerProperty("loadUrlTimeoutValue", 60000);
    this.appView.clearCache(false);
    this.appView.clearHistory();

    // Set some defaults
    this.appView.setHorizontalScrollBarEnabled(false);
    this.appView.setHorizontalScrollbarOverlay(false);
    this.appView.setVerticalScrollBarEnabled(false);
    this.appView.setVerticalScrollbarOverlay(false);

    if (getIntent().hasExtra(Constants.EVENT.MESSAGE_RECEIVED)) {
        // Application is started by clicking on notification
        PushNotifications.handleMessage(getIntent());
    }

    // Set some defaults on the web view
    this.appView.getSettings().setBuiltInZoomControls(false);
    this.appView.getSettings().setSupportZoom(true);
    this.appView.getSettings().setGeolocationEnabled(true);
    this.appView.getSettings().setLightTouchEnabled(false);

    // Caching is preventin android 2.3.3 from working properly with REST calls (ETST-5834, ETST-6716)
    this.appView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);

    this.appView.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);

    /*
    Enabling hardware acceleration to make CSS rules like translate3d work properly.
    0x01000000 is actually WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED flag, but it doesn't exist in
    android 2.2.1 lib that is present in maven dependency management.
     */
    if (android.os.Build.VERSION.SDK_INT >= 11) {
        getWindow().setFlags(0x01000000, 0x01000000);
    }
}

我在活动中没有onResume方法。

你能发布你的onResume()方法吗?发布你的onCreate()和onResume()方法我添加了onCreate方法-没有onResume方法-谢谢你的回复。在onCreate方法setContentView(R.layout.your\u layout)中添加这一行;在super.onCreate(savedInstanceState)之后;是的,这扼杀了这个应用程序——我想是因为它是一个phonegap应用程序——在android应用程序中有一个网络视图——这可能就是原因
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Log.d(TAG, "onCreate");

    int splashImageResourceIdentifier = getResources().getIdentifier("splash", "drawable", getPackageName());
    if (splashImageResourceIdentifier != 0) {
        super.setIntegerProperty("splashscreen", splashImageResourceIdentifier);
        super.loadUrl(WORK_DIR + getStartFileName(), 10000);
    } else {
        super.loadUrl(WORK_DIR + getStartFileName());
    }

    super.setIntegerProperty("loadUrlTimeoutValue", 60000);
    this.appView.clearCache(false);
    this.appView.clearHistory();

    // Set some defaults
    this.appView.setHorizontalScrollBarEnabled(false);
    this.appView.setHorizontalScrollbarOverlay(false);
    this.appView.setVerticalScrollBarEnabled(false);
    this.appView.setVerticalScrollbarOverlay(false);

    if (getIntent().hasExtra(Constants.EVENT.MESSAGE_RECEIVED)) {
        // Application is started by clicking on notification
        PushNotifications.handleMessage(getIntent());
    }

    // Set some defaults on the web view
    this.appView.getSettings().setBuiltInZoomControls(false);
    this.appView.getSettings().setSupportZoom(true);
    this.appView.getSettings().setGeolocationEnabled(true);
    this.appView.getSettings().setLightTouchEnabled(false);

    // Caching is preventin android 2.3.3 from working properly with REST calls (ETST-5834, ETST-6716)
    this.appView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);

    this.appView.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);

    /*
    Enabling hardware acceleration to make CSS rules like translate3d work properly.
    0x01000000 is actually WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED flag, but it doesn't exist in
    android 2.2.1 lib that is present in maven dependency management.
     */
    if (android.os.Build.VERSION.SDK_INT >= 11) {
        getWindow().setFlags(0x01000000, 0x01000000);
    }
}