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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:38:01+00:00 2026-06-03T22:38:01+00:00

I am facing this problem that buttons in android are not clickable when given

  • 0

I am facing this problem that buttons in android are not clickable when given a background. So, I used ImageButton.
In the Java file how are ImageButtons declared?
I have a red otification badge in a textview which I wanted to place on the top right corner of the ImageButton. But the textView is not visible over the button i.e it gets half hidden behind the button. What is the solution for this?

Another problem is that my project faces a force close problem. The log cat shows:

05-11 04:13:29.508: D/(3913): after defining intent

05-11 04:13:29.678: D/AndroidRuntime(3913): Shutting down VM

05-11 04:13:29.678: W/dalvikvm(3913): threadid=1: thread exiting with uncaught exception (group=0x4001d800)

05-11 04:13:29.688: E/AndroidRuntime(3913): FATAL EXCEPTION: main

05-11 04:13:29.688: E/AndroidRuntime(3913): java.lang.RuntimeException: Unable to start activity ComponentInfo
{phone.activities/phone.activities.leave}: java.lang.NullPointerException

05-11 04:13:29.688: E/AndroidRuntime(3913):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)

05-11 04:13:29.688: E/AndroidRuntime(3913):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)

05-11 04:13:29.688: E/AndroidRuntime(3913):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)

05-11 04:13:29.688: E/AndroidRuntime(3913):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)

05-11 04:13:29.688: E/AndroidRuntime(3913):     at android.os.Handler.dispatchMessage(Handler.java:99)

05-11 04:13:29.688: E/AndroidRuntime(3913):     at android.os.Looper.loop(Looper.java:123)

05-11 04:13:29.688: E/AndroidRuntime(3913):     at android.app.ActivityThread.main(ActivityThread.java:4627)

05-11 04:13:29.688: E/AndroidRuntime(3913):     at java.lang.reflect.Method.invokeNative(Native Method)

05-11 04:13:29.688: E/AndroidRuntime(3913):     at java.lang.reflect.Method.invoke(Method.java:521)

05-11 04:13:29.688: E/AndroidRuntime(3913):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)

05-11 04:13:29.688: E/AndroidRuntime(3913):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)

05-11 04:13:29.688: E/AndroidRuntime(3913):     at dalvik.system.NativeStart.main(Native Method)

05-11 04:13:29.688: E/AndroidRuntime(3913): Caused by: java.lang.NullPointerException

05-11 04:13:29.688: E/AndroidRuntime(3913):     at phone.activities.leave.onCreate(leave.java:33)

05-11 04:13:29.688: E/AndroidRuntime(3913):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)

05-11 04:13:29.688: E/AndroidRuntime(3913):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)

05-11 04:13:29.688: E/AndroidRuntime(3913):     ... 11 more

What is the reason for force close?

<?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:layout_gravity="right"
android:orientation="vertical" android:clickable="true">

<LinearLayout
    android:id="@+id/linearLayout1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:gravity="center"
        android:paddingLeft="90dp"
        android:paddingRight="58dp"
        android:text="eApproval"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:textSize="22dp"
        android:textStyle="bold"
        android:typeface="sans" />
</LinearLayout>


<TableLayout
    android:id="@+id/tableLeft"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="left"
    android:paddingLeft="20dp"
    android:paddingRight="30dp"
    android:paddingTop="25dp" >



    <TableRow
        android:layout_width="match_parent"
        android:layout_height="match_parent">
<RelativeLayout android:layout_marginLeft="10dp">


    <Button
        android:id="@+id/buttonLeave"
        android:layout_width="70dp"
        android:layout_height="70dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginBottom="5dp"
        android:layout_marginLeft="20dp"
        android:layout_marginTop="10dp"
        android:clickable="true"
      />


 <TextView
 android:id="@+id/textOne"
 android:layout_width="30dp"
 android:layout_height="30dp"
 android:layout_marginLeft="70dp"
 android:background="@drawable/picture1"
 android:gravity="center"
 android:text="5"
 android:textColor="#FFF"
 android:textSize="14dp"
 android:textStyle="bold"
 android:typeface="sans" />

</RelativeLayout>       
<RelativeLayout android:paddingLeft="20dp" android:layout_marginLeft="10dp">
<Button
        android:id="@+id/buttonTime"
        android:layout_width="70dp"
        android:layout_height="70dp"
        android:layout_marginBottom="5dp"
        android:layout_marginLeft="25dp"
        android:clickable="true"

        android:height="60dp"
        android:width="30dp" 
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true" android:layout_marginTop="10dp" />


<TextView
android:id="@+id/textTwo"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginLeft="80dp"
android:background="@drawable/picture1"
android:gravity="center"
android:text="4"
android:textColor="#FFF"
android:textSize="14dp"
android:textStyle="bold"
android:typeface="sans" />

</RelativeLayout>

    </TableRow>
    <TableRow >
        <TextView
            android:id="@+id/textLeave"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Leave Requests"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textSize="15dp"
            android:textStyle="normal|bold"
            android:typeface="sans"
            android:width="90dp" android:layout_marginLeft="20dp"
android:padding="5dp"
android:gravity="center"/>

         <TextView
            android:id="@+id/textTime"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Time Booking"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textSize="15dp"
            android:textStyle="bold"
            android:typeface="sans"
            android:width="90dp" android:layout_marginLeft="50dp" android:padding="5dp" 
android:gravity="center"/>
   </TableRow>

    <TableRow
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
<RelativeLayout android:layout_marginLeft="10dp">

    <Button
        android:id="@+id/buttonCart"
        android:layout_width="70dp"
        android:layout_height="70dp"
        android:layout_marginBottom="5dp"
        android:layout_marginLeft="20dp"

        android:height="60dp"
        android:width="30dp" 
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true" android:layout_marginTop="10dp" 
android:clickable="true"/>


 <TextView
 android:id="@+id/textThree"
 android:layout_width="30dp"
 android:layout_height="30dp"
 android:layout_marginLeft="70dp"
 android:background="@drawable/picture1"
 android:gravity="center"
 android:text="2"
 android:textColor="#FFF"
 android:textSize="14dp"
 android:textStyle="bold"
 android:typeface="sans" />

</RelativeLayout>       
<RelativeLayout android:paddingLeft="20dp" android:layout_marginLeft="10dp">
<Button
        android:id="@+id/buttonInvoice"
        android:layout_width="70dp"
        android:layout_height="70dp"
        android:layout_marginBottom="5dp"
        android:layout_marginLeft="25dp"

        android:height="60dp"
        android:width="30dp" 
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true" android:layout_marginTop="10dp" 
android:clickable="true"/>


<TextView
android:id="@+id/textFour"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginLeft="80dp"
android:background="@drawable/picture1"
android:gravity="center"
android:text="3"
android:textColor="#FFF"
android:textSize="14dp"
android:textStyle="bold"
android:typeface="sans" />

</RelativeLayout>

    </TableRow>
      <TableRow >
        <TextView
            android:id="@+id/textCart"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:clickable="false"
            android:text="Shopping Cart"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textSize="15dp"
            android:textStyle="bold"
            android:typeface="sans"
            android:width="90dp" android:layout_marginLeft="20dp" android:padding="5dp" 
android:gravity="center"/>

         <TextView
            android:id="@+id/textInvoice"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:clickable="false"
            android:text="Invoice"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textSize="15dp"
            android:textStyle="bold"
            android:typeface="sans"
            android:width="90dp" android:layout_marginLeft="50dp" android:padding="5dp" 
android:gravity="center"/>
   </TableRow>


    <TableRow
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
<RelativeLayout android:layout_marginLeft="10dp">

    <Button
        android:id="@+id/buttonPurchase"
        android:layout_width="70dp"
        android:layout_height="70dp"
        android:layout_marginBottom="5dp"
        android:layout_marginLeft="20dp"

        android:height="60dp"
        android:width="30dp" 
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true" android:layout_marginTop="10dp" 
android:clickable="true"/>


 <TextView
 android:id="@+id/textFive"
 android:layout_width="30dp"
 android:layout_height="30dp"
 android:layout_marginLeft="70dp"
 android:background="@drawable/picture1"
 android:gravity="center"
 android:text="4"
 android:textColor="#FFF"
 android:textSize="14dp"
 android:textStyle="bold"
 android:typeface="sans" />

</RelativeLayout>

<RelativeLayout android:paddingLeft="20dp" android:layout_marginLeft="10dp">

<Button
    android:id="@+id/buttonTravel"
    android:layout_width="70dp"
    android:layout_height="70dp"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:layout_marginBottom="5dp"
    android:layout_marginLeft="25dp"
    android:layout_marginTop="10dp"

    android:clickable="true"
    android:height="60dp"
    android:width="30dp" />


<TextView
    android:id="@+id/textSix"
    android:layout_width="30dp"
    android:layout_height="30dp"
    android:layout_marginLeft="80dp"
    android:background="@drawable/picture1"
    android:gravity="center"
    android:text="7"
    android:textColor="#FFF"
    android:textSize="14dp"
    android:textStyle="bold"
    android:typeface="sans" />

</RelativeLayout>

    </TableRow>


    <TableRow >
        <TextView
            android:id="@+id/textPurchase"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:clickable="false"
            android:text="Purchase Order"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textSize="15dp"
            android:textStyle="bold"
            android:typeface="sans"
            android:width="90dp" android:layout_marginLeft="20dp" android:padding="5dp" 
android:gravity="center"/>

         <TextView
            android:id="@+id/textTravel"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:clickable="false"
            android:text="Travel Approval"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textSize="15dp"
            android:textStyle="bold"
            android:typeface="sans"
            android:width="90dp" android:layout_marginLeft="50dp" android:padding="5dp"
android:gravity="center"/>
   </TableRow>
</TableLayout>

</LinearLayout>

The onCreate method is :
package phone.activities;

import phone.activities.R;
import phone.activities.R.id;
import phone.activities.R.layout;

import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class EApprovalActivity extends Activity implements OnClickListener {
private static final String TAG = null;


/** Called when the activity is first created. */
@Override

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


    Button leaveButton;
    leaveButton = (Button)findViewById(R.id.buttonLeave);
    leaveButton.setOnClickListener(this);

    Button timeButton;
    timeButton = (Button)findViewById(R.id.buttonTime);
    timeButton.setOnClickListener(this);

    Button cartButton;
    cartButton = (Button)findViewById(R.id.buttonCart);
    cartButton.setOnClickListener(this);

    Button invoiceButton;
    invoiceButton = (Button)findViewById(R.id.buttonInvoice);
    invoiceButton.setOnClickListener(this);

    Button purchaseButton;
    purchaseButton = (Button)findViewById(R.id.buttonPurchase);
    purchaseButton.setOnClickListener(this);

    Button travelButton;
    travelButton = (Button)findViewById(R.id.buttonTravel);
    travelButton.setOnClickListener(this);

}


public void onClick(View v) {
    ComponentName cn;
    switch(v.getId())
    {
    case R.id.buttonLeave:
        Intent leaveIntent = new Intent(EApprovalActivity.this,
leave.class); 
        startActivity(leaveIntent);                 
        break;

    case R.id.buttonTime:
        Intent timeIntent = new Intent(EApprovalActivity.this,
time.class); 
        startActivity(timeIntent);                  
        break;

    case R.id.buttonCart:
        Intent cartIntent = new Intent(EApprovalActivity.this, 
cart.class); 
        startActivity(cartIntent);                  
        break;

    case R.id.buttonInvoice:
        Intent invoiceIntent = new Intent(EApprovalActivity.this, 
invoice.class); 
        startActivity(invoiceIntent);                   
        break;

    case R.id.buttonPurchase:
        Intent purchaseIntent = new Intent(EApprovalActivity.this, 
purchase.class); 
        startActivity(purchaseIntent);                  
        break;

    case R.id.buttonTravel:
        Intent travelIntent = new Intent(EApprovalActivity.this, 
travel.class); 
        startActivity(travelIntent);                    
        break;


    } Log.d(TAG,"after defining intent");
    }
}
  • 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-03T22:38:03+00:00Added an answer on June 3, 2026 at 10:38 pm

    In the Java file how are ImageButtons declared?

    ImageButton ib = findByViewId(R.id.yourImageButtonId);
    

    the textView is not visible over the button i.e it gets half hidden
    behind the button. What is the solution for this?

    You can set Text to a button no need to put a textview over it.

    Also you can give a simple button a android:drawableOnTop attribute,
    the given recource appears on top.

    To your other problem:

    Check line 33 in your onCreate() method. Post it if you cant find the NullPointer on your own.

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

Sidebar

Related Questions

Brand new to android and facing a weird problem.Check out the code below FirstActivity.java:
I´m facing this problem: I have a Button that works like a WrapPanel using
I'm facing this problem again and again, but can't find any solution (except mine,
I'm currently facing this problem with ruby on rails 3, devise and facebook oauth.
I am facing this problem upon pushing my app to Heroku: 500 internal server
I was facing this unique problem of generating a bit-mask based on the input
This is a problem am facing for long now also asked a question regarding
This is a design problem I am facing. Let's say I have a cars
I am facing the problem while inserting data this way. How to insert data
I'm facing a problem with IE6. I took the toggle function from this website

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.