I have an application that uses crosswalk. I use it in two activities.
- In this activity, I have a crosswalk view that shows a list of selectable items and when selected launch another activity.
- In this new activity I open another crosswalk view that runs the selected item from the previous activity.
The issue that I am having is when in the second activity when I press the back button it goes back to a black screen. If I press the back button again, it then closes the activity.
What can I do to close the activity instead of going back to the black screen? This doesn't happen on all items just a few, and with those few I think that a page redirect is happening in crosswalk so when I press back it just goes to the previous screen.
Here is the activity:
package com.gamesmart.gamesmart;
import android.app.Activity;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import org.xwalk.core.XWalkPreferences;
import org.xwalk.core.XWalkView;
public class Play extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_play);
Intent intent = getIntent();
String url = intent.getStringExtra("url");
XWalkView xWalkWebView = (XWalkView)findViewById(R.id.xwalkWebViewPlay);
// Turn on debugging if we are in DEBUG mode
if (BuildConfig.DEBUG) {
XWalkPreferences.setValue(XWalkPreferences.REMOTE_DEBUGGING, true);
}
// Load the url
xWalkWebView.load(url, null);
}
@Override
public void onBackPressed(){
finish();
}
}
I don't think that my onBackPressed
is doing what it should be...