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?










share|improve this question


























    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?










    share|improve this question
























      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?










      share|improve this question













      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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 8 at 22:17









      denis

      92




      92
























          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.




          1. Make a toast to tell the user to come back to your application.

          2. 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.






          share|improve this answer





















          • 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











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          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

























          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.




          1. Make a toast to tell the user to come back to your application.

          2. 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.






          share|improve this answer





















          • 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















          up vote
          0
          down vote













          Not directly.



          There are two ways I see you could work with this limitation.




          1. Make a toast to tell the user to come back to your application.

          2. 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.






          share|improve this answer





















          • 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













          up vote
          0
          down vote










          up vote
          0
          down vote









          Not directly.



          There are two ways I see you could work with this limitation.




          1. Make a toast to tell the user to come back to your application.

          2. 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.






          share|improve this answer












          Not directly.



          There are two ways I see you could work with this limitation.




          1. Make a toast to tell the user to come back to your application.

          2. 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.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          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


















          • 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


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          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





















































          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







          Popular posts from this blog

          Guess what letter conforming each word

          Port of Spain

          Run scheduled task as local user group (not BUILTIN)