Android WebView + ProgressBar + Swipe to Refresh + Custom Error Page On Network Failure Tutorial

Поделиться
HTML-код
  • Опубликовано: 14 ноя 2024

Комментарии • 59

  • @abaaexpress6628
    @abaaexpress6628 4 года назад +1

    the code works for me but I find that when I go back using the Phone's back button, it exits the app. How to fix this please?

    • @codeflaretech
      @codeflaretech  4 года назад +1

      Hello. That's very possible. You just need to check for key events like so:
      @Override
      public boolean onKeyDown(int keyCode, KeyEvent event) {
      if ((keyCode == KeyEvent.KEYCODE_BACK) && webView.canGoBack()) {
      webView.goBack();
      return true;
      }
      return super.onKeyDown(keyCode, event);
      }
      NB: This should be outside of the onCreate and the WebViewClient Class.
      Also for those wondering how to hide the ActionBar, use this:
      getSupportActionBar().hide();
      Plus, I've updated the repo to support your request. You can find it in the video description.
      Regards.

    • @abaaexpress6628
      @abaaexpress6628 4 года назад +1

      That you. I have corrected that already. Thanks for the help. Please do a video tutorial of how to configure push notifications on the app. it will be so very helpful.

    • @segsfault
      @segsfault 3 года назад +1

      This is a short implementation
      @Override
      public void onBackPressed() {
      if (webView.canGoBack()) { webView.goBack(); }
      else { super.onBackPressed(); }
      }

  • @NFTSuperDrops
    @NFTSuperDrops 3 года назад

    Nice video and well explained. Could you kindly show us how to add bottom navigation to the webview app?

  • @reiden1019
    @reiden1019 2 года назад

    Can you do a image upload with camera support and also do a bluetooth printing support? thank you so much your code is so much helpfull

  • @mxh.wahyxdz
    @mxh.wahyxdz 3 года назад

    how to order
    disable swiperefreshlayout in the bootstrap modal..?

  • @littlestar2322
    @littlestar2322 4 года назад

    Nice lesson...
    Bro, may i ask something ?
    How could to remove text WEBVIEW on the top(header) of the apps ?

    • @codeflaretech
      @codeflaretech  4 года назад +1

      OK. That's the application name. Go to your res folder there you'll see an xml file called strings.xml. Modify this line
      Add Your App Name . There you go

    • @littlestar2322
      @littlestar2322 4 года назад

      @@codeflaretech thanks man... I will try...

    • @codeflaretech
      @codeflaretech  4 года назад

      @@littlestar2322 All right. Regards bro.

  • @syntaxbytesolutions5565
    @syntaxbytesolutions5565 2 года назад

    Hello, It keeps returning back to Base Url when page os refreshed!

  • @zakariahouache5442
    @zakariahouache5442 2 года назад

    thenks sur!,,,
    Is there a function so that when the Internet is cut off,
    it does not work WebView and when the Internet returns,
    it works WebView automatically ,And when the internet is weak it works "is Loading"or "circiller progresidec idicaitor"

  • @Rangabhari
    @Rangabhari 3 года назад +1

    I am create education application from news application which is licensed and I am getting it from youtube then how I could use this for my application and there is coming any legal issues for use it and publishing application and if not then what changes is required

    • @codeflaretech
      @codeflaretech  3 года назад

      If you know the URL of the news site, sure you can bundle that onto your app. If didn't build and don't own the news site, you will have to request permission from the owners to avoid litigation.

  • @sanjay-rr5vd
    @sanjay-rr5vd 4 года назад

    how to open any or all external link (target = _blank) links in other activity window. in web view project. plz make a complete video tutorial about this topic.
    i didn't find any video on RUclips for this topic

    • @codeflaretech
      @codeflaretech  4 года назад

      OK. I will do one soon. You can subscribe so that you'll get notified when I upload it.

  • @smbiplob9476
    @smbiplob9476 4 года назад

    i have a video download website ,i have made my webview app for downloading websites, but in webview app, download is not working. but if I don't use webviewclient and if I open my app with other browser download is working. please make a video about how to write a program to support download in webview or advanced webview app.

  • @iamkrishn
    @iamkrishn 3 года назад

    Learned a lot. Well Done!

  • @dhirajpardeshi8598
    @dhirajpardeshi8598 3 года назад

    Can you please make video on how to remove footer in webview

  • @rahulroy-km6bc
    @rahulroy-km6bc 2 года назад

    sir mere website me userapna current location fetch kar sakta he but vhi webview app me ni ho rha
    mene apke anusar app bana liya he but location work ni kar rha can u help sir please?

  • @codeflaretech
    @codeflaretech  4 года назад +1

    Important update:
    For those that are getting errors because their websites are not SSL enabled, I have done a workaround on the code to support both http and https. I wrote a code to check for SSL error and also added this dependency, android:usesClearTextTraffic = "true"
    to the Android manifest file.
    I have also updated the GitHub repo, which is available in the video description.
    Regards.

  • @joydaniels9739
    @joydaniels9739 4 года назад

    Awesome. Thanks

  • @crisptimes6559
    @crisptimes6559 3 года назад

    Delay mills how you give in android studio I am trying not showing please help me any short cut

  • @saddamskst2
    @saddamskst2 3 года назад +1

    Sir in webview how can i give the user to offline download Feature of videos which will not be visible on phone but that should be only available on App📱
    Please solve my issue, its urgent also

    • @codeflaretech
      @codeflaretech  3 года назад

      OK. This is a great question.
      What you can do is to store your videos offline using SQLite, for instance. Then you can check if the app is offline and redirect the user to the offline page.

    • @saddamskst2
      @saddamskst2 3 года назад

      @@codeflaretech sir i want to store the offline download data to user device with hidden directory and how could i do this please help me my mail id is skst000786@gmail.com or my whatsapp number is +91 7076065439

    • @saddamskst2
      @saddamskst2 3 года назад

      @@codeflaretech i will wait for your reply sir

    • @saddamskst2
      @saddamskst2 3 года назад

      @@codeflaretech sir please reply i want offline download feature like youtube▶️

    • @codeflaretech
      @codeflaretech  3 года назад +1

      @@saddamskst2 OK. The first thing to do is store your files offline using database like SQLite, for example.
      Then you can check for network connection when the app loads. If there's no network connection, you can redirect the user to your offline page where the video can be downloaded. That's the process you have to follow.

  • @jaskeetuppal
    @jaskeetuppal 4 года назад

    Hi,
    I want to ask you,
    I have some difficulty in showing the error page,
    I copied the code in Main activity, made the asset folder, html file was uploaded but it didn't show,
    I have made the changes only in the Main file,
    Am I suppose to make the changes anywhere else as well?
    (For url loading error only)

    • @codeflaretech
      @codeflaretech  4 года назад

      You could check if the path to your the offline html file in the assets folder is valid.

  • @mulkproject687
    @mulkproject687 4 года назад

    Bro is it possible to add refresh button on the header? or a floating button if yes? please let me know thanks..

    • @codeflaretech
      @codeflaretech  4 года назад +1

      Yes bro, very possible. Just to add your button, set OnclickListner for it and then add the code for the refresh function so that what you achieve when you swipe, you can also achieve when you click on that button. Cheers.

    • @mulkproject687
      @mulkproject687 4 года назад

      @@codeflaretech nice ill try this so do i have to do the same what you did on the swipe i will have to declare it on the main activity? or i can re use the swipe function?.. And last bro.. U think it would be possible to have bell icon and when new push notifcation from Firebase mesage or Onesignal, autmatically that bell icon will appear the count of notifications..

    • @codeflaretech
      @codeflaretech  4 года назад

      @@mulkproject687 Yes, you will have to declare the button in your MainActivity by using findViewById and then setting OnclickListner for it. And yes, you can add push notifications from firebase as well. You will have to first add firebase to your app to get started.

    • @mulkproject687
      @mulkproject687 4 года назад

      @@codeflaretech bro, i have this modal forms in my website when using webview those form wont submit just doing nothing its keeps of freezing.. But if uses browser it works..

    • @codeflaretech
      @codeflaretech  4 года назад

      @@mulkproject687 Ok. You might need to setJavaScriptEnabled in the manifest.xml file

  • @smbiplob9476
    @smbiplob9476 4 года назад

    My code is similar to you,but i am getting this error:Attempt to invoke virtual method 'void androidx.swiperefreshlayout.widget.SwipeRefreshLayout.setOnRefreshListener(androidx.swiperefreshlayout.widget.SwipeRefreshLayout$OnRefreshListener)' on a null object reference
    at com.multiinstamessengerandposter.MainActivity.onCreate(MainActivity.java:88).please help.

    • @codeflaretech
      @codeflaretech  4 года назад

      Hi Shorifa, this means that you probably forgot to implement the findViewById feature for the swipeRefreshLayout. Go to your xml file check for the id and call it in your Java file.

    • @smbiplob9476
      @smbiplob9476 4 года назад

      @@codeflaretech Thank you so much for your response to my comment.your video was awesome, it really works.

  • @vinaybakle6443
    @vinaybakle6443 3 года назад

    Whenever i rotate the app it reloads the initial URL. How to avoid that. I want to show only current URL irrespective of orientation.

    • @codeflaretech
      @codeflaretech  3 года назад +1

      OK. Just add this to your manifest file: android:configChanges=”orientation|screenSize” That should do the trick.
      Also if you prefer to lock rotation to portrait, add this: android:screenOrientation="portrait"
      Regards.

    • @vinaybakle6443
      @vinaybakle6443 3 года назад

      @@codeflaretech thanks it worked!

    • @codeflaretech
      @codeflaretech  3 года назад

      @@vinaybakle6443 All right. Glad I could help. Regards.

  • @syedfardeen7074
    @syedfardeen7074 4 года назад

    It's really good working

  • @rodrigovenancio1778
    @rodrigovenancio1778 2 года назад

    when i do

  • @Technicalgurushw
    @Technicalgurushw 3 года назад

    Can I connect With Firebase Url To This Application

    • @codeflaretech
      @codeflaretech  3 года назад

      Yes, you can.

    • @Technicalgurushw
      @Technicalgurushw 3 года назад

      @@codeflaretech when Url Change In Firebase Database it Also Change in This Webview

  • @jsc8409
    @jsc8409 4 года назад

    not working, maybe not working on android 10

    • @codeflaretech
      @codeflaretech  4 года назад

      Hello JKK Mojokerto. What problems are you having?

    • @jsc8409
      @jsc8409 4 года назад

      @@codeflaretech I run on android 10, i made a webpage to upload file, with jquery filereader to show file's thumbnail before uploaded
      On my android, image file from sdcard shows perfectly, but image file captured by camera doesnt shows
      But on the android 7-9, they're all shows

    • @jsc8409
      @jsc8409 4 года назад

      @@codeflaretech oh and i'm not directly upload file from input type='file', but i create a canvas to draw the thumbnail to reduce its size then upload the canvas
      The image captured by camera doesnt show its thumbnail, so my canvas draws nothing

  • @rightmilk4720
    @rightmilk4720 4 года назад

    Not clear your screen bad experience