Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8430875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:42:15+00:00 2026-06-10T05:42:15+00:00

I have a Fragment activity that has a ListFragment on the left and a

  • 0

I have a Fragment activity that has a ListFragment on the left and a Fragment on the right that has a WebView. The functionality works fine but I would like to display a progress dialog showing “Loading…” while the web page finishes loading. How can I accomplish this seemingly trivial task?

Below is my code:

public class ArticleListActivity extends FragmentActivity implements
    ArticleListFragment.OnArticleSelectedListener {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.articlelist_fragment);
    }

    public void onArticleSelected(String contentLink) {
        ArticleViewerFragment viewer = (ArticleViewerFragment) getSupportFragmentManager()
                .findFragmentById(R.id.articleview_fragment);

        if (viewer == null || !viewer.isInLayout()) {
            Intent showContent = new Intent(getApplicationContext(),
                    ArticleViewerActivity.class);

            showContent.setData(Uri.parse(contentLink));
            startActivity(showContent);
        } else {
            viewer.updateUrl(contentLink);
        }
    }
}

Here is my FragmentActivity

public class ArticleViewerActivity extends FragmentActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.articleview_fragment);

        Intent launchingIntent = getIntent();
        String content = launchingIntent.getData().toString();

        ArticleViewerFragment viewer = (ArticleViewerFragment) getSupportFragmentManager()
                .findFragmentById(R.id.articleview_fragment);

        viewer.updateUrl(content);
    }
}

and here is my Fragment

public class ArticleViewerFragment extends Fragment {

    private ProgressDialog progressBar; 

    private WebView viewer = null;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        viewer = (WebView) inflater.inflate(R.layout.webview_layout, container, false);
        viewer.loadUrl("file:///android_asset/default.html");
        return viewer;
    }

    public void updateUrl(String newUrl) {
        if (viewer != null) {
            viewer.loadUrl(newUrl);
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T05:42:17+00:00Added an answer on June 10, 2026 at 5:42 am

    Use this code:

    final ProgressDialog pd = ProgressDialog.show(this, "", "Loading...", true);
    pd.setCancelable(false);
    
    webview.getSettings().setJavaScriptEnabled(true);
    webview.getSettings().setSupportZoom(true);
    webview.getSettings().setBuiltInZoomControls(true);
    webview.setWebViewClient(new WebViewClient() {
        @Override
        public void onPageFinished(WebView view, String url) {
            if (pd != null && pd.isShowing()) {
                pd.dismiss();
            }
        }
    });
    webview.loadUrl("file:///android_asset/default.html");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok so i have an activity A that has a fragment A, and an
Say I have an activity that has fragments added programmatically: private void animateToFragment(Fragment newFragment,
Good day. I have an app that has one main activity which holds 3
I have an Activity that has 2 fragments. Both are ListFragments and both contribute
In my Android application, I have a fragment activity which it has a progressbar.
Hope you guys can help, I have a activity that has tabs, each tab
I have searched the numerous questions that look like this one, but haven't found
I have a fragment view that needs replacement with another fragment. When the ListFragment
So I have an Activity which has a FragmentPagerAdapter and inside each fragment I
I have a fragment which has its own state (selected buttons, etc). That state

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.