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 8706319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:35:13+00:00 2026-06-13T03:35:13+00:00

I want to put a button on top of webview. For this I’ve defined

  • 0

I want to put a button on top of webview. For this I’ve defined XML as:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <WebView
        android:id="@+id/webview_news_fullscreen"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" />

    <Button
        android:id="@+id/done_btn_news_fullscreen"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:background="@drawable/done_btn" />

</RelativeLayout>

Activity Class:

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.article_full_screen);
    url = getIntent().getExtras().getString(Universal.TAG_PERMALINK);
    done_button = (Button)findViewById(R.id.done_btn_news_fullscreen);
    done_button.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            finish();
        }
    });

    webView = (WebView)findViewById(R.id.webview_news_fullscreen);
    webView.loadUrl(url);
}

However, every time I run my code it crashes and gives a “java.lang.ClassCastException: android.webkit.WebView” error. Please help me out !

LogCat:

10-19 15:08:52.683: E/AndroidRuntime(845): FATAL EXCEPTION: main
10-19 15:08:52.683: E/AndroidRuntime(845): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.newsreaderui/com.example.newsreaderui.fullarticle.ArticleFullScreen}: java.lang.ClassCastException: android.webkit.WebView
10-19 15:08:52.683: E/AndroidRuntime(845):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
10-19 15:08:52.683: E/AndroidRuntime(845):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
10-19 15:08:52.683: E/AndroidRuntime(845):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
10-19 15:08:52.683: E/AndroidRuntime(845):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
10-19 15:08:52.683: E/AndroidRuntime(845):  at android.os.Handler.dispatchMessage(Handler.java:99)
10-19 15:08:52.683: E/AndroidRuntime(845):  at android.os.Looper.loop(Looper.java:123)
10-19 15:08:52.683: E/AndroidRuntime(845):  at android.app.ActivityThread.main(ActivityThread.java:4627)
10-19 15:08:52.683: E/AndroidRuntime(845):  at java.lang.reflect.Method.invokeNative(Native Method)
10-19 15:08:52.683: E/AndroidRuntime(845):  at java.lang.reflect.Method.invoke(Method.java:521)
10-19 15:08:52.683: E/AndroidRuntime(845):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
10-19 15:08:52.683: E/AndroidRuntime(845):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
10-19 15:08:52.683: E/AndroidRuntime(845):  at dalvik.system.NativeStart.main(Native Method)
10-19 15:08:52.683: E/AndroidRuntime(845): Caused by: java.lang.ClassCastException: android.webkit.WebView
10-19 15:08:52.683: E/AndroidRuntime(845):  at com.example.newsreaderui.fullarticle.ArticleFullScreen.onCreate(ArticleFullScreen.java:26)
10-19 15:08:52.683: E/AndroidRuntime(845):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
10-19 15:08:52.683: E/AndroidRuntime(845):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
10-19 15:08:52.683: E/AndroidRuntime(845):  ... 11 more
  • 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-13T03:35:14+00:00Added an answer on June 13, 2026 at 3:35 am

    Try to clean and rebuild the project. Stupid answer maybe but there are issues with the generation of the R.java file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

http://buttonspace.com/ I want to put equal space between the 4 buttons at the top,
I want put a button on android edittextpreference. I create a custom editextpreference: public
i want to put Go button in android appliation softkeyboard for search and other
Problem: I want to put Twitter Share Button in my Google Map InfoWindow. I
I want to put an image on a button, but I want part of
I'm trying to put a button at the bottom of a webview. For some
I want to put a pop-up on top of some markers in a MapView
I'd like to modify this PictureBox Array Project. i want to put a reset
I have a LinearLayout, which only contains one button. I want this button to
I want to put an element into another component (in this case a print

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.