Back to application button after opening browser
up vote
0
down vote
favorite
I have a webview that loads particular website on it the user has to do a validation that can only be done by the browser, the user clicks on the link and opens the android browser and does this validation, it is possible to create a back button for the application at the top of the browser because after the validation the user has no way to go back to the application, on the iphone there is the navigation controller and when the user clicks on a link that opens browser is created a back button on top of the mobile is possible on android?
java android webview
add a comment |
up vote
0
down vote
favorite
I have a webview that loads particular website on it the user has to do a validation that can only be done by the browser, the user clicks on the link and opens the android browser and does this validation, it is possible to create a back button for the application at the top of the browser because after the validation the user has no way to go back to the application, on the iphone there is the navigation controller and when the user clicks on a link that opens browser is created a back button on top of the mobile is possible on android?
java android webview
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a webview that loads particular website on it the user has to do a validation that can only be done by the browser, the user clicks on the link and opens the android browser and does this validation, it is possible to create a back button for the application at the top of the browser because after the validation the user has no way to go back to the application, on the iphone there is the navigation controller and when the user clicks on a link that opens browser is created a back button on top of the mobile is possible on android?
java android webview
I have a webview that loads particular website on it the user has to do a validation that can only be done by the browser, the user clicks on the link and opens the android browser and does this validation, it is possible to create a back button for the application at the top of the browser because after the validation the user has no way to go back to the application, on the iphone there is the navigation controller and when the user clicks on a link that opens browser is created a back button on top of the mobile is possible on android?
java android webview
java android webview
asked Nov 8 at 22:17
denis
92
92
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
Not directly.
There are two ways I see you could work with this limitation.
- Make a toast to tell the user to come back to your application.
- Use a touchable overlay and add it to the display when the user performs the action that directs them to the browser. When that overlay is tapped, have your application "relaunch."
You can make a simple clickable overlay like this:
ImageView button = new ImageView(context); //this can be any View you want, even your own custom subclass
button.setImageResource(R.drawable.back);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//handle relaunching your app here
}
})
WindowManager.LayoutParams params = new WindowManager.LayoutParams();
params.height = 50; //height and width are in pixels
params.width = 50;
params.type = Build.VERSION.SDK_INT > Build.VERSION_CODES.N_MR1 ?
WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY :
WindowManager.LayoutParams.TYPE_PHONE;
params.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
params.gravity = Gravity.TOP | Gravity.START;
WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
manager.addView(button, params); //add the button to the screen
manager.removeView(button); //remove the button from the screen
You'll need the SYSTEM_ALERT_WINDOW_PERMISSION for this: How to handle SYSTEM_ALERT_WINDOW permission not being auto-granted on some pre-Marshmallow devices
To handle relaunching your app, add launchMode="singleInstance"
to your Activity tag in your AndroidManifest and then simply use startActivity()
on it from inside the onClick()
method.
I get error in the "context"
– denis
Nov 10 at 0:11
You have to pass a Context object.
– TheWanderer
Nov 10 at 0:20
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Not directly.
There are two ways I see you could work with this limitation.
- Make a toast to tell the user to come back to your application.
- Use a touchable overlay and add it to the display when the user performs the action that directs them to the browser. When that overlay is tapped, have your application "relaunch."
You can make a simple clickable overlay like this:
ImageView button = new ImageView(context); //this can be any View you want, even your own custom subclass
button.setImageResource(R.drawable.back);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//handle relaunching your app here
}
})
WindowManager.LayoutParams params = new WindowManager.LayoutParams();
params.height = 50; //height and width are in pixels
params.width = 50;
params.type = Build.VERSION.SDK_INT > Build.VERSION_CODES.N_MR1 ?
WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY :
WindowManager.LayoutParams.TYPE_PHONE;
params.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
params.gravity = Gravity.TOP | Gravity.START;
WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
manager.addView(button, params); //add the button to the screen
manager.removeView(button); //remove the button from the screen
You'll need the SYSTEM_ALERT_WINDOW_PERMISSION for this: How to handle SYSTEM_ALERT_WINDOW permission not being auto-granted on some pre-Marshmallow devices
To handle relaunching your app, add launchMode="singleInstance"
to your Activity tag in your AndroidManifest and then simply use startActivity()
on it from inside the onClick()
method.
I get error in the "context"
– denis
Nov 10 at 0:11
You have to pass a Context object.
– TheWanderer
Nov 10 at 0:20
add a comment |
up vote
0
down vote
Not directly.
There are two ways I see you could work with this limitation.
- Make a toast to tell the user to come back to your application.
- Use a touchable overlay and add it to the display when the user performs the action that directs them to the browser. When that overlay is tapped, have your application "relaunch."
You can make a simple clickable overlay like this:
ImageView button = new ImageView(context); //this can be any View you want, even your own custom subclass
button.setImageResource(R.drawable.back);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//handle relaunching your app here
}
})
WindowManager.LayoutParams params = new WindowManager.LayoutParams();
params.height = 50; //height and width are in pixels
params.width = 50;
params.type = Build.VERSION.SDK_INT > Build.VERSION_CODES.N_MR1 ?
WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY :
WindowManager.LayoutParams.TYPE_PHONE;
params.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
params.gravity = Gravity.TOP | Gravity.START;
WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
manager.addView(button, params); //add the button to the screen
manager.removeView(button); //remove the button from the screen
You'll need the SYSTEM_ALERT_WINDOW_PERMISSION for this: How to handle SYSTEM_ALERT_WINDOW permission not being auto-granted on some pre-Marshmallow devices
To handle relaunching your app, add launchMode="singleInstance"
to your Activity tag in your AndroidManifest and then simply use startActivity()
on it from inside the onClick()
method.
I get error in the "context"
– denis
Nov 10 at 0:11
You have to pass a Context object.
– TheWanderer
Nov 10 at 0:20
add a comment |
up vote
0
down vote
up vote
0
down vote
Not directly.
There are two ways I see you could work with this limitation.
- Make a toast to tell the user to come back to your application.
- Use a touchable overlay and add it to the display when the user performs the action that directs them to the browser. When that overlay is tapped, have your application "relaunch."
You can make a simple clickable overlay like this:
ImageView button = new ImageView(context); //this can be any View you want, even your own custom subclass
button.setImageResource(R.drawable.back);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//handle relaunching your app here
}
})
WindowManager.LayoutParams params = new WindowManager.LayoutParams();
params.height = 50; //height and width are in pixels
params.width = 50;
params.type = Build.VERSION.SDK_INT > Build.VERSION_CODES.N_MR1 ?
WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY :
WindowManager.LayoutParams.TYPE_PHONE;
params.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
params.gravity = Gravity.TOP | Gravity.START;
WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
manager.addView(button, params); //add the button to the screen
manager.removeView(button); //remove the button from the screen
You'll need the SYSTEM_ALERT_WINDOW_PERMISSION for this: How to handle SYSTEM_ALERT_WINDOW permission not being auto-granted on some pre-Marshmallow devices
To handle relaunching your app, add launchMode="singleInstance"
to your Activity tag in your AndroidManifest and then simply use startActivity()
on it from inside the onClick()
method.
Not directly.
There are two ways I see you could work with this limitation.
- Make a toast to tell the user to come back to your application.
- Use a touchable overlay and add it to the display when the user performs the action that directs them to the browser. When that overlay is tapped, have your application "relaunch."
You can make a simple clickable overlay like this:
ImageView button = new ImageView(context); //this can be any View you want, even your own custom subclass
button.setImageResource(R.drawable.back);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//handle relaunching your app here
}
})
WindowManager.LayoutParams params = new WindowManager.LayoutParams();
params.height = 50; //height and width are in pixels
params.width = 50;
params.type = Build.VERSION.SDK_INT > Build.VERSION_CODES.N_MR1 ?
WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY :
WindowManager.LayoutParams.TYPE_PHONE;
params.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
params.gravity = Gravity.TOP | Gravity.START;
WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
manager.addView(button, params); //add the button to the screen
manager.removeView(button); //remove the button from the screen
You'll need the SYSTEM_ALERT_WINDOW_PERMISSION for this: How to handle SYSTEM_ALERT_WINDOW permission not being auto-granted on some pre-Marshmallow devices
To handle relaunching your app, add launchMode="singleInstance"
to your Activity tag in your AndroidManifest and then simply use startActivity()
on it from inside the onClick()
method.
answered Nov 8 at 22:31
TheWanderer
5,66111025
5,66111025
I get error in the "context"
– denis
Nov 10 at 0:11
You have to pass a Context object.
– TheWanderer
Nov 10 at 0:20
add a comment |
I get error in the "context"
– denis
Nov 10 at 0:11
You have to pass a Context object.
– TheWanderer
Nov 10 at 0:20
I get error in the "context"
– denis
Nov 10 at 0:11
I get error in the "context"
– denis
Nov 10 at 0:11
You have to pass a Context object.
– TheWanderer
Nov 10 at 0:20
You have to pass a Context object.
– TheWanderer
Nov 10 at 0:20
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53216999%2fback-to-application-button-after-opening-browser%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown