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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:09:26+00:00 2026-06-05T05:09:26+00:00

In a TabHost, I’m setting up a TabSpec that consists of a header area

  • 0

In a TabHost, I’m setting up a TabSpec that consists of a header area with a few buttons and below, a ListView. The Activity to manage this TabSpec is defined as “extends ListActivity”.
However, now I’m running into the problem of not being able to define an OnClickListener to check for the submit button pressed. How can I solve that?

Trying to cast the Button by

btnRatingSubmit.setOnClickListener((OnClickListener) this);

raises an ClassCastException…

Here is a basic excerpt of the layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<RatingBar
    android:id="@+id/ratingBar"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

<EditText
    android:id="@+id/edComment"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:inputType="textMultiLine" >
</EditText>

<Button
    android:id="@+id/btnSubmit"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/btnSubmit" />

<ListView
    android:id="@android:id/list"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" />

</LinearLayout>
  • 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-05T05:09:28+00:00Added an answer on June 5, 2026 at 5:09 am

    Instead of

    btnRatingSubmit.setOnClickListener((OnClickListener) this);
    

    try this:

    btnRatingSubmit.setOnClickListener(new View.OnClickListener(){
    
    public void onClick(View v) {
                // TODO Auto-generated method stub
    
            }
        }); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

onItemClick listener in ListView is not working in TabHost I visited this URL.I don't
Like in topic - I want to create activity above tabHost that I already
Using this sample : I have make my own Fragment that holds tabhost and
I have a TabHost activity as main activity of my app. This TabHost contains
I have a TabHost with a ListView inside a tab. When the activity starts,
I built my own TabHost with this code: I have a problem that when
I have a custom TabHost that adds tabs like this private void setTab(View view,
I have an activity that has a TabHost containing a set of TabSpecs each
I use a TabHost. The below code to call AActivity. intent = new Intent().setClass(this,
I have a tabhost created by this.tabHost = getTabHost(); // Resusable TabSpec for each

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.