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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:41:50+00:00 2026-05-29T05:41:50+00:00

I have the following Custom Component: <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent android:layout_height=@dimen/bottom_actionbar_item_height android:orientation=horizontal android:gravity=center> <Button android:id=@+id/btnLogin

  • 0

I have the following Custom Component:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="@dimen/bottom_actionbar_item_height"
android:orientation="horizontal"  
android:gravity="center">

    <Button
        android:id="@+id/btnLogin"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:background="@drawable/botton_button_selector"
        android:drawableLeft="@drawable/balloon_overlay_close"            
        android:text="@string/bottonbar_earned" 
        android:layout_weight="1" android:clickable="true" android:focusable="true"
        android:layout_marginRight="10dp"/>

    <Button
        android:id="@+id/btnLogin2"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:background="@drawable/botton_button_selector"
        android:drawableLeft="@drawable/balloon_overlay_close"
        android:layout_marginRight="10dp"
        android:text="@string/bottonbar_inprogress" android:focusable="true" android:clickable="true" />        

     <Button
        android:id="@+id/btnLogin3"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:background="@drawable/botton_button_selector"
        android:drawableLeft="@drawable/balloon_overlay_close"
        android:text="@string/bottonbar_redeemed"
        android:layout_marginRight="10dp"
        android:layout_weight="1" android:focusable="true" android:clickable="true"/>

</LinearLayout>

I have my main.xml which has a main RelativeLayout, with many other layouts on it, and one of them is my custom component. Custom component is shown correctly, but no listener is being invoked.
My Custom Component class has the following code:

public class BottomActionBar extends LinearLayout implements OnClickListener{

private LayoutInflater mInflater;
private LinearLayout mBarView;

public BottomActionBar(Context context, AttributeSet attrs) {
    super(context, attrs);

    mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    mBarView = (LinearLayout) mInflater.inflate(R.layout.bottom_actionbar, null);
    addView(mBarView);

    Button bt1 = (Button) mBarView.findViewById(R.id.btnLogin);
    bt1.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            Toast.makeText(getContext(), "test", Toast.LENGTH_SHORT);
        }
    });
}

@Override
public boolean onTouchEvent(MotionEvent evt) {
    System.out.print("test");
    return super.onTouchEvent(evt);
}

public void onClick(View v) {
    System.out.print("test");       
}

}

Now, when testing this, nothing shows up! I also tried inflating the component in my main layout:

mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    mBarView = (LinearLayout) mInflater.inflate(R.layout.bottom_actionbar, null);

    Button bt1 = (Button) mBarView.findViewById(R.id.btnLogin);
    bt1.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            Toast.makeText(getApplicationContext(), "test", Toast.LENGTH_SHORT);                
        }
    });

What am I doing wrong?

Thanks everyone

  • 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-29T05:41:52+00:00Added an answer on May 29, 2026 at 5:41 am

    You forgot to add “.show()” at the end of the Toast line in the onClick() method! 🙂

    Toast.makeText(getApplicationContext(), “test”, Toast.LENGTH_SHORT).show();

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

Sidebar

Related Questions

Say I have the following custom component: <s:Group xmlns:fx=http://ns.adobe.com/mxml/2009 xmlns:s=library://ns.adobe.com/flex/spark xmlns:mx=library://ns.adobe.com/flex/mx> <fx:Script> <![CDATA[ [Bindable]
I've written the following custom component, SubNavBar.mxml: <?xml version=1.0 encoding=utf-8?> <mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml height=100 width=300
I have a custom component that is a combination of LinearLayout + ImageViewx2 +
I have the following methods in my simple Custom Parser Class, when I execute
I have the following situation: There is one custom view inside of the first
I have the following code in WCF service to throw a custom fault based
I have the following lines in my ~/.emacs.d/init.el (custom-set-variables '(flymake-allowed-file-name-masks (quote ( (\\.cc\\' flymake-simple-make-init)
I have used the following article as a guide to creating a custom EditorPart
What I am attempting to do is the following: I have a custom object
I have a custom control that has the following prototype. Type.registerNamespace('Demo'); Demo.CustomTextBox = function(element)

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.