从一个活动切换到另一个活动时出现Android Phonegap Black Screen

时间:2013-12-19 05:20:33

标签: android cordova

我正在开发Hybrid Phonegap / Native Android应用程序。从ActivityA过渡到ActivityB时,会出现黑屏。我想在显示ActivityB之前防止闪烁。

import org.apache.cordova.DroidGap;

import android.os.Bundle;
import android.view.Menu;

public class ActivityA extends DroidGap
{
    @Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    super.init();
    //setContentView(R.layout.activity_main);
    super.loadUrl("file:///android_asset/www/index.html");
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}
}

public class ActivityB extends DroidGap 
{

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    super.init();       
    super.loadUrl("file:///android_asset/www/view.html");
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}

} 

0 个答案:

没有答案