public class Myactivity extends DroidGap {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_myactivity);
}
@Override
public void onDestroy() {
this.finish();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.myactivity, menu);
return true;
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_BACK)) {
super.loadUrl("file:///asset/www/index.html");
}
return super.onKeyDown(keyCode, event);
}
在上面我需要在单击后退按钮时转到 index.html 文件。但是当我尝试它时,我得到以下错误。
11-02 12:25:00.677: E/WindowManager(24344): Activity org.apache.cordova.example.Myactivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@421fad78 that was originally added here
11-02 12:25:00.677: E/WindowManager(24344): android.view.WindowLeaked: Activity org.apache.cordova.example.Myactivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@421fad78 that was originally added here