android why this button is not clickable

android make button not clickable
android button onclick example
button click not working android
how to make button not clickable
android first click not working
android widget button not working
button android
android studio button click

I don't know why the last two buttons is not clickable, I used the background (that i set to them ) many time and it works with another layouts, I am sure that the wrong is something like foucable or clickable but i don't know where exactly .

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#FFFFFF"
    android:fillViewport="true" >

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <LinearLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="#FFFFFF"
            android:orientation="vertical" >

            <RelativeLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="20dip"
                android:layout_marginLeft="10dip"
                android:layout_marginRight="10dip"
                android:layout_marginTop="20dip"
                android:layout_weight="1" >

                <Button
                    android:id="@+id/b_orderMeal_selectRestaurant"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:layout_alignParentLeft="true"
                    android:layout_marginRight="30dip"
                    android:text="@string/b_selectRestaurant" />

                <ImageView
                    android:id="@+id/iv_orderMeal_isSelectRestaurant"
                    android:layout_width="25dp"
                    android:layout_height="25dp"
                    android:layout_alignParentRight="true"
                    android:contentDescription="@string/iv_isSelected"
                    android:src="@drawable/x" />
            </RelativeLayout>

            <RelativeLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="20dip"
                android:layout_marginLeft="10dip"
                android:layout_marginRight="10dip"
                android:layout_marginTop="20dip"
                android:layout_weight="1" >

                <Button
                    android:id="@+id/b_orderMeal_selectMealItems"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:layout_alignParentLeft="true"
                    android:layout_marginRight="30dip"
                    android:text="@string/b_select_MealItems" />

                <ImageView
                    android:id="@+id/iv_orderMeal_isSelectMealItems"
                    android:layout_width="25dp"
                    android:layout_height="25dp"
                    android:layout_alignParentRight="true"
                    android:contentDescription="@string/iv_isSelected"
                    android:src="@drawable/x" />
            </RelativeLayout>

            <RelativeLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="20dip"
                android:layout_marginLeft="10dip"
                android:layout_marginRight="10dip"
                android:layout_marginTop="20dip"
                android:layout_weight="1" >

                <Button
                    android:id="@+id/b_orderMeal_selectPayMethod"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:layout_alignParentLeft="true"
                    android:layout_marginRight="30dip"
                    android:text="@string/b_selectPayMethod" />

                <ImageView
                    android:id="@+id/iv_orderMeal_isSelectPayMethod"
                    android:layout_width="25dp"
                    android:layout_height="25dp"
                    android:layout_alignParentRight="true"
                    android:contentDescription="@string/iv_isSelected"
                    android:src="@drawable/x" />
            </RelativeLayout>

            <Button
                android:id="@+id/b_orderMeal_checkBasket"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dip"
                android:layout_marginRight="40dip"
                android:layout_marginTop="20dip"
                android:layout_weight="1"
                android:text="@string/b_check_basket" />

            <TextView
                android:id="@+id/tv_orderMeal_errorMessage"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="20dip"
                android:layout_marginRight="20dip"
                android:layout_marginTop="30dip"
                android:layout_weight="1"
                android:text="@string/tv_orderMeal_errorMessage"
                android:textColor="#FF0000"
                android:textSize="20dip"
                android:textStyle="bold"
                android:typeface="sans" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:background="@drawable/bg_selector"
            android:orientation="horizontal" >

            <Button
                android:id="@+id/b_orderMeal_send"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginRight="4dip"
                android:layout_weight="1"
                android:background="@drawable/button_bg"
                android:text="@string/b_send"
                android:focusable="true"
                android:clickable="true"
                android:textColor="#FFFFFF" />

            <Button
                android:id="@+id/b_orderMeal_cancel"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="4dip"
                android:layout_weight="1"
                android:background="@drawable/button_bg"
                android:text="@string/b_cancel"
                android:clickable="true"
                android:textColor="#FFFFFF" />
        </LinearLayout>
    </RelativeLayout>

</ScrollView>

I am talking about the last two buttons

java
b_send = (Button) findViewById(R.id.b_orderMeal_send);
        b_send.setOnClickListener(this);
        b_cancel = (Button) findViewById(R.id.b_orderMeal_cancel);
        b_cancel.setOnClickListener(this);
on click
@Override
    public void onClick(View v) {
      case R.id.b_orderMeal_cancel:
        Toast.makeText(this, "roma", Toast.LENGTH_LONG);
        break;          
    }
note

the toast doesn't appear

I don't know why the last two buttons is not clickable, I used the background (that i set to them ) many time and it works with another layouts, I am sure that the wrong is something like foucable or clickable but i don't know where exactly .

I think your XML design is OK in all ways so problem is most likely in Java. Most likely you forgot to register OnClickListener for your Button(s).

Button btn = (Button) findViewById(R.id.b_orderMeal_send);
btn.setOnClickListener(new View.OnClickListener() {
    public void onClick(View v) {
       Toast.makeText(this, "Click event works.", Toast.LENGTH_SHORT).show();
     }
 }));

Or you can use OnClickListener interface and then

public void onClick(View v) {
   switch (v.getId()) {
      case R.id.b_orderMeal_send:
         Toast.makeText(this, "Click event works.", Toast.LENGTH_SHORT).show();
      break;
   }
}

How to set button not clickable while animating on Android?, I think that in first case first click just takes focus. And second click is "real" click. [ code]<style name="ButtonStyle" parent="@android:style/Widget.Holo.Button">� When you are setting view.setOnClickListener on any View, eg: myButton.setOnClickListener(new OnClickListener) by default it is considered as clickable="true". So you would not need to mention that in the XML file like android:clickable="true". The onClick() event will be fired without using android:clickable="true".

Some times Emulator will make the problem so I would like to intimate you guys to use a Real Android device for checking/running your Application

How to solve application widget button not responding to click event , This was a simple CSS bug in the firefox layout, fixed in the next build. I am struggling to get the Navigation drawer items to register and start and intent for a new activity. The drawer opens fine and is displayed correctly but nothing happens when I click on the item

Replace your onClick() method with below one and let us know about logcat. it seems you are trying to show toast but missing .show() method to show the toast. Try below code and let us know

 @Override
 public void onClick(View v) {
 if(v.equals(b_send)){
     Toast.makeText(this,"b_send clicked", Toast.LENGTH_LONG).show();
     Log.d("TEMP TAG","b_send clicked");
 } else if(v.equals(b_cancel)){ 
    Toast.makeText(this,"b_cancel clicked", Toast.LENGTH_LONG).show();
      Log.d("TEMP TAG","b_cancel clicked");
      }

  }

Button, it shows the element "cancel" button can be found. but it just failed with click action. .then(function () { log(39, 'waitForElementPresent "//button[contains(text()� I created a android studio button for my app and when I click on the register button it doesn't work . I don't get any errors it just doesn't work . When the user clicks the register button I want to go to the login activity .

set clickable = true in the xml for your button and try this in your code.

findViewById(R.id.b_orderMeal_send).setOnClickListener(commonClickListener);
findViewById(R.id.b_orderMeal_cancel).setOnClickListener(commonClickListener);


private OnClickListener commonClickListener = new OnClickListener() {
@Override
public void onClick(View v) {
    int selectedItemId = v.getId();
    switch (selectedItemId) {
    case R.id.b_orderMeal_send:
        Toast.makeText(this, "roma", Toast.LENGTH_LONG).show();
        break;
    case R.id.b_orderMeal_cancel:
    Toast.makeText(this, "roma", Toast.LENGTH_LONG).show();
        break;


    }
}

Search button not clickable on its whole area, I added two radio button options to my registration form. Support � Plugin: Ultimate Member - User Profile & Membership Plugin � Radio buttons not clickable { display:none; } .um-icon-android-checkbox-outline::before { content: none; }� I don't know why the last two buttons is not clickable, I used the background (that i set to them ) many time and it works with another layouts, I am sure that the wrong is something like foucable or clickable but i don't know where exactly . I think your XML design is OK in all ways so problem is most likely in Java.

Same thing kept happening to me but my situation was a little different. First the buttons were working fine and both were clickable then all of a sudden after a couple of relaunches they completely stopped working.

I simply Quit the Emulator then relaunched it and the buttons started working again

Having Element is not clickable at point (859, 476), And when I go to click the queue button, which is now at the bottom-right of the now playing page, it is greyed out and not clickable. Is this a bug? Is there a better� In this chapter you learn how to create buttons and clickable images for triggering actions. Designing buttons. People like to press buttons. Show someone a big red button with a message that says "Do not press" and the person will probably press the button, just for the pleasure of pressing a big red button.

Radio buttons not clickable, When I open site on Android, I can't click on any button. Suppose you’re testing an application that has a form and a “submit” button. Developers sometimes disable the “submit” button until all the data in the form is filled. The developers can also design the application in such a way that the “submit” button is enabled only after the data validation is done.

Queue Button Not Clickable, Issue Description I implemented this component to support a chat in Firebase and it's working really nice but on Android, the send button is not� The first reason is this really isn’t a robust solution. If you add another button you now have to determine which button was clicked, typically that’ll involve a switch/case statement. In the

The buttons on the site are not clickable on Android. � Issue #19 , One of the most common reason to android home button stopped working is system OS update or screen replacement. Let see some possible solutions that can fix home button not working on android phonehttps://www.bestusefultips.com/home-butt. Also software key problem is the common hardware problem after update OS.

Comments
  • And how do you know they are not clickable? where is your java code?
  • Hope you added the code for OnClickListener for the last two buttons. Please check oyour code and confirm
  • You should add some logs or somthing in onClick, else how will you know is it clickable or not?
  • pls post the entire implementation of onClick. what are you using in switch statement?
  • thank you all ............
  • my activity is implements onclicklistenr
  • I dont know where is the problem , i am confused about this issue
  • Check my updated answer. I recommend to compare int values with switch than equals method...
  • i alread using switch case but sorry i didn't show you that , sorry , it still not working , I already did all your code,
  • it must works because it works for me. Copy my code and clean and rebuild your project and try it again.
  • whis is the deverent ? i always make switch case, here where is the wrong ? any way i will try your solution
  • Check it again, you are missing .show() on toast.makeText method, and implement View.onClickListener interface in your activity.
  • And you can use switch or equal, result gonna same. So no worries.
  • But i do not recommend to use equals method for this goal. Its dirty and there is better and more clean solution.
  • @user2059935 Welcome, if it was the .show() problem you should mark my answer as accepted,as I clearly mention that in a very first place, No? nyways happy coding :)