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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:46:16+00:00 2026-05-30T09:46:16+00:00

findViewById can’t retrieve a button and a radiusBar even though their id exists. code

  • 0

findViewById can’t retrieve a button and a radiusBar even though their id exists. code crashes when initiating saveButton or radiusBar.

acticity:

    private Button saveButton;
    private EditText titleText;
    private SeekBar radiusBar;
    private TextView radiusValue;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        titleText = (EditText) findViewById(R.id.title);
        radiusValue = (TextView) findViewById(R.id.radiusValue);
        saveButton = (Button) findViewById(R.id.confirm);
    radiusBar = (SeekBar) findViewById(R.id.radiusBar);

xml file:

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

<TextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:padding="3dp"
    android:text="@string/title"
    android:textColor="#00ffff"
    android:textSize="20sp"
    android:textStyle="bold" />

<EditText
    android:id="@+id/title"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:padding="3dp" >

    <requestFocus />
</EditText>

<TextView
    android:id="@+id/myLocationText"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:padding="3dp"
    android:text="@string/hello"
    android:textColor="#ffffff"
    android:textSize="15sp" />

<com.google.android.maps.MapView
    android:id="@+id/myMapView"
    android:layout_width="fill_parent"
    android:layout_height="300dp"
    android:apiKey="my google maps api key"
    android:clickable="true"
    android:enabled="true"
    android:padding="5dp" >
</com.google.android.maps.MapView>

<RelativeLayout
    android:id="@+id/relativeLayout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <TextView
        android:id="@+id/radiusText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:paddingLeft="3dip"
        android:paddingRight="3dip"
        android:text="@string/proximity"
        android:textColor="#00ffff"
        android:textSize="20sp"
        android:textStyle="bold" />

    <LinearLayout
        android:id="@+id/linearLayout1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:layout_toRightOf="@+id/radiusText" >

        <TextView
            android:id="@+id/radiusValue"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingLeft="3dip"
            android:paddingRight="3dip"
            android:text="@string/radius"
            android:textColor="#00ffff"
            android:textSize="20sp"
            android:textStyle="bold" />
    </LinearLayout>

    <SeekBar
        android:id="@+id/radiusBar"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/radiusText"
        android:max="1000"
        android:padding="5dip"
        android:soundEffectsEnabled="true" />

    <Button
        android:id="@+id/confirm"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/radiusBar"
        android:padding="3dp"
        android:text="@string/confirm"
        android:textSize="20sp" />
</RelativeLayout>

i am new at android. even though i used old school comment out way or ddms i couldn’t find why this is happening. thanks for the help.

  • 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-30T09:46:17+00:00Added an answer on May 30, 2026 at 9:46 am

    When you say “crash”, you should go on to say “… and this is the log output with the error message”. Anyway, the resource IDs certainly exist, as your code compiles. However, a common build system error with Android is that your resource IDs can be wrong after you reorder some XML. I think you’ll find that the error is a ClassCastException. The solution: clean your repo (e.g., with ant clean, or some button/menu in Eclipse) and recompile everything from scratch.

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

Sidebar

Related Questions

How can i retrieve the text of a dynamically created radio button selected by
Can someone help with this code. what am looking for is for the button
I have a simple question, how can I stop timer? Button bCancel = (Button)findViewById(R.id.bt1);
How can I extend ImageView , so that I can use in my code
How can I retrieve one activity arraylist into another activity and store,update and clear?
Can someone explain to me why this AlertDialog crashes? package com.clicker; import android.app.Activity; import
I have problem, i can't play video in webview by html5 here,my code webView
How can I change the padding of a TableLayout programmatic. I try this code,
Hi how i can use custom listview with textview and imageview.i tried following code
how i can put im2 in the correct place FrameLayout rv =(FrameLayout)findViewById(R.id.my_ph); ImageView im1

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.