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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:35:40+00:00 2026-05-27T12:35:40+00:00

I am very new to Android development, so I appologise in advance if this

  • 0

I am very new to Android development, so I appologise in advance if this is a “noobish” question.

Using a RelativeLayout, I have a ToggleButton with an ID of reminderToggle:

<ToggleButton
    android:id="@+id/reminderToggle"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBaseline="@+id/reminderDesc"
    android:layout_alignBottom="@+id/reminderDesc"
    android:layout_toRightOf="@+id/imageView1"
    android:text="ToggleButton" />

I am using:

ToggleButton reminderToggle = (ToggleButton)findViewById(R.id.reminderToggle);

then later:

if(reminderToggle.isChecked()) {

inside a button onClick listener, inside of onCreate, to see of the ToggleButton is checked. This was all working fine. I don’t know what I did, but now the app crashes when the button is clicked. In LogCat`, I can see

FATAL EXCEPTION: main
java.lang.ClassCastException: android.widget.TextView cannot be cast to android.widget.ToggleButton
at nz.co.kwiius.park.ParkActivity$4.onClick(ParkActivity.java:139)

Line 139 is:

ToggleButton reminderToggle = (ToggleButton)findViewById(R.id.reminderToggle);

As you can see in the XML, reminderToggle is a ToggleButton. So what’s all this fuss about? 🙂

Thanks in advance,
JJ56

PS: There is only one thing with id of reminderToggle, which is this ToggleButton

  • 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-05-27T12:35:41+00:00Added an answer on May 27, 2026 at 12:35 pm

    Clean and rebuild it dude. Also make sure you check build automatically always to avoid such problems.

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

Sidebar

Related Questions

Doing Android development on a Mac and this very new phone I have doesn't
I'm very new on Android development. I have this: AlertDialog.Builder builder = new AlertDialog.Builder(this);
I am very new to Android development. I have this code: Button btnLaunch; btnLaunch=(Button)findViewById(R.id.btnLaunch);
I am very new to Android development and Java. Have read around but I'm
i m new to this android application development i would be very much grateful
I am very new to android development and have been trying to draw a
I am new to Android development. Please excuse me If my question is very
I am very new to android development.... i have created an app and want
i am very new to the android app development, and i have just almost
I'm very new to Android development and can't find the answer to this. I

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.