Home>

I go to a WebView, for example, to Yandex. Then I go to the post office to the registration department. I close the application through the taskbar and reopen it -I see that I am on the original url. How to save the state of the WebView? And in general, you also need to download files and pay via WebView, where you can get acquainted with this in detail, otherwise on the Internet there are only answers to questions how to fix saving data when you rotate the screen. In general, how to save a session?

  • Answer # 1

    Well, all about "save after closing the application" is to save the state to the device and restore this state when you open your WebView.

    Here you have 3 options in general:

    1. If the data is simple enough (for example, just a link) then use it.
    2. If something is more complex then you should probably create a database. Here either use SQLite, or what is simpler and more efficient -connect Room persistence library.
    3. You can also save to the device as a file. I don’t think this is what you want, but in general you can use this method as well.

    As far as I know, there are no other ways to store something after unloading the application from memory (well, or they are not at all obvious)

  • Answer # 2

    Well, all about "save after closing the application" is to save the state to the device and restore this state when you open your WebView.

    Here you have 3 options in general:

    1. If the data is simple enough (for example, just a link) then use it.
    2. If something is more complex then you should probably create a database. Here either use SQLite, or what is simpler and more efficient -connect Room persistence library.
    3. You can also save to the device as a file. I don’t think this is what you want, but in general you can use this method as well.

    As far as I know, there are no other ways to store something after unloading the application from memory (well, or they are not at all obvious)

  • Answer # 3

    Replace

    MessageDigest.getInstance ("** SHA256 **"); `
    

    on

    MessageDigest.getInstance (** "SHA-256" **);
    

    @Sergei Buvaka unfortunately I confused and answered the wrong place, delete if possible

    инкогнито2021-09-25 23:58:59

    You can delete your answer yourself. I can't do it

    Sergei Buvaka2021-09-25 23:58:59
  • Answer # 4

    Replace

    MessageDigest.getInstance ("** SHA256 **"); `
    

    on

    MessageDigest.getInstance (** "SHA-256" **);
    

    @Sergei Buvaka unfortunately I confused and answered the wrong place, delete if possible

    инкогнито2021-09-25 23:58:59

    You can delete your answer yourself. I can't do it

    Sergei Buvaka2021-09-25 23:58:59