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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T09:50:28+00:00 2026-06-05T09:50:28+00:00

My problem is really straight forward. I can’t seem to figure out why it’s

  • 0

My problem is really straight forward. I can’t seem to figure out why it’s throwing an error of this kind (to add, I’ve never really used Java but have to for a simple android app now).

In my activity class I declare:

private MyWebView web;

Inside the ‘onCreate’ method I do this:

try {
    web = (MyWebView)findViewById(R.id.webview);
}
catch(Exception e) {
    Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT);
}

The class ‘MyWebView’ looks like this:

import android.app.AlertDialog;
import android.content.Context;
import android.util.AttributeSet;
import android.webkit.WebView;


public class MyWebView extends WebView {
    public MyWebView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        // TODO Auto-generated constructor stub
    }

    @Override
    public void onScrollChanged(int l, int t, int oldl, int oldt) {
    }
}

This throws an a ‘ClassCastException’ with detailMessage = “android.webkit.WebView.

I’d really appreciate some help.

Thanks

  • 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-05T09:50:30+00:00Added an answer on June 5, 2026 at 9:50 am

    you have to name your custom WebView like this in your layout:

    <yourpackagename.MyWebView
      android:id="@+id/webview"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent" 
     />
    

    yourpackagename: is the name of the package in wich you decalred your MyWebView Class

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

Sidebar

Related Questions

I can't get a straight forward answer on this. Is Google's V8 engine really
I've had this problem in a few different apps now and I can't seem
I've got a problem that I think is probably straight forward but I can't
Having a really aggravating problem using Managed Metadata in SP2010 where I can get
This is a really strange problem, that appears to be somewhat intermittent (although it
I've got a really annoying problem, and as much as I've searched, I can't
It's a really simple problem. I've got HTML code like this : <div> <img
The problem for me is pretty straight forward. Onclick of an anchor tag ,
This design problem is turning out to be a bit more interesting than I'd
I'm stuck on a problem I really don't know how to solve: I have

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.