I found that putting the line "getWindow().requestFeature
(Window.FEATURE_PROGRESS);" higher in the code after "setContentView
(R.layout.main);" worked for me.

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // Let's display the progress in the activity title bar, like
the
        // browser app does.
        getWindow().requestFeature(Window.FEATURE_PROGRESS);

        setContentView(R.layout.main);

        WebView webview = new WebView(this);
        setContentView(webview);
        setProgressBarVisibility(true);

        webview.getSettings().setJavaScriptEnabled(true);


On Dec 9, 8:02 am, Nugman <klaus.nuta...@googlemail.com> wrote:
> Add this line of code:
>
> ...
> setContentView(webview);
> setProgressBarVisibility(true);
> ...
>
> Greets Klaus
>
> On 7 Dez., 16:33, Marton Kodok <pentiu...@gmail.com> wrote:
>
> > I am still after a solution to this problem too.
>
> > 2009/12/5 Richard <ldonel...@gmail.com>
>
> > > I'm following the Android docs example for a webview progress too.
>
> > > My code compiles and runs, but I don't actually see the progress bar.
> > > I confirmed that the onProgress method was firing (via debug).  Can
> > > someone point me down the right path?
>
> > > public class WebViewTest extends Activity {
> > >    /** Called when the activity is first created. */
> > >   �...@override
> > >    public void onCreate(Bundle savedInstanceState) {
> > >        super.onCreate(savedInstanceState);
>
> > >        // Let's display the progress in the activity title bar, like
> > > the
> > >        // browser app does.
> > >         getWindow().requestFeature(Window.FEATURE_PROGRESS);
>
> > >         WebView webview = new WebView(this);
> > >         webview.getSettings().setJavaScriptEnabled(true);
>
> > >        final Activity activity = this;
> > >        webview.setWebChromeClient(new WebChromeClient() {
> > >          public void onProgressChanged(WebView view, int progress) {
> > >            // Activities and WebViews measure progress with different
> > > scales.
> > >            // The progress meter will automatically disappear when we
> > > reach 100%
> > >            activity.setProgress(progress * 1000);
> > >          }
> > >        });
>
> > >         webview.setWebViewClient(new WebViewClient() {
> > >           public void onReceivedError(WebView view, int errorCode,
> > > String description, String failingUrl) {
> > >            Toast.makeText(activity, "Oh no! " + description,
> > > Toast.LENGTH_SHORT).show();
> > >          }
> > >        });
>
> > >         webview.loadUrl("http://yahoo.com/";);
>
> > >        setContentView(webview);
> > >     }
> > > }
>
> > > On Nov 1, 7:18 am, Marton Kodok <pentiu...@gmail.com> wrote:
> > > > Thank you!
>
> > > > 2009/11/1 donthorp <dth...@gmail.com>
>
> > > > > You need to make sure you're requesting the feature before you set
> > > > > your content view.
>
> > > > > On Oct 30, 1:01 pm, Marton Kodok <pentiu...@gmail.com> wrote:
> > > > > > I have this code to setup a progress bar for my webview.
> > > > > > I get an error on runtime on the first marked line. What is wrong?
>
> > > > > > getWindow().requestFeature(Window.FEATURE_PROGRESS); // hangs out on
> > > this
> > > > > > line
>
> > > > > >         final Activity activity = this;
> > > > > >         webview.setWebChromeClient(new WebChromeClient() {
> > > > > >           public void onProgressChanged(WebView view, int progress) 
> > > > > > {
> > > > > >             // Activities and WebViews measure progress with
> > > different
> > > > > > scales.
> > > > > >             // The progress meter will automatically disappear when
> > > we
> > > > > reach
> > > > > > 100%
> > > > > >             activity.setProgress(progress * 1000);
> > > > > >           }
> > > > > >         });
>
> > > > > > 1. What I am doing wrong?
> > > > > > 2. the Debugger doesn't pick up the line, it was a pain to detect 
> > > > > > the
> > > > > line,
> > > > > > what is missing from Eclipse? I get source path not found error.
>
> > > > > > Marton
>
> > > > > --
> > > > > You received this message because you are subscribed to the Google
> > > > > Groups "Android Beginners" group.
> > > > > To post to this group, send email to
> > > android-beginners@googlegroups.com
> > > > > To unsubscribe from this group, send email to
> > > > > android-beginners+unsubscr...@googlegroups.com<android-beginners%2Bunsubscr
> > > > >  i...@googlegroups.com>
> > > <android-beginners%2bunsubscr...@googlegroups.com<android-beginners%252Buns
> > >  ubscr...@googlegroups.com>
>
> > > > > For more options, visit this group at
> > > > >http://groups.google.com/group/android-beginners?hl=en
>
> > > > --
> > > > Márton
>
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Beginners" group.
> > > To post to this group, send email to android-beginners@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > android-beginners+unsubscr...@googlegroups.com<android-beginners%2Bunsubscr
> > >  i...@googlegroups.com>
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-beginners?hl=en
>
> > --
> > Márton

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to