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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:18:35+00:00 2026-06-07T16:18:35+00:00

I have one imageButton. When I clicked on ImageButton. It makes VISIBLE another layout(childLayout)

  • 0

I have one imageButton. When I clicked on ImageButton. It makes VISIBLE another layout(childLayout) at top of the Parent Layout android:id=”@+id/mainLayout”.Now ChildLayout have three buttons (Back, Call, Web). I implemented OnClickListeners for Back, Call & Web buttons.But when i clicked on “back” button it not fired event. But when i double click on buttons OnClickListener worked. Why OnClickListener not worked at single click.?

         @Override
                public void onSingleTapConfirmed() {
                    childLayout = (LinearLayout) findViewById(R.id.childView);
                    childLayout.setVisibility(View.VISIBLE);
                    backButton = (Button)findViewById(R.id.back);
                    web = (ImageButton) findViewById(R.id.web);
                    call = (ImageButton) findViewById(R.id.call);
                    backButton.setOnClickListener(backButtonListener);
                    call.setOnClickListener(callListener);
                    web.setOnClickListener(webListener);
                }

            OnClickListener callListener = new OnClickListener() {

                        @Override
                        public void onClick(View v) {
                            Intent callIntent = new Intent(Intent.ACTION_CALL);
                            callIntent.setData(Uri.parse("tel:415-817-9955,’10"));
                            startActivity(callIntent);                  
                        }
                    };

            OnClickListener webListener = new OnClickListener() {

                        @Override
                        public void onClick(View v) {
                            Intent web = new Intent(Intent.ACTION_VIEW);
                            Uri u = Uri.parse("http://google.com");
                            web.setData(u);
                            startActivity(web);
                        }
                    };  
             OnClickListener backButtonListener = new OnClickListener() {

                @Override
                public void onClick(View v) {
                    finish();
                }
            };

and my xml file :

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


    <LinearLayout
        android:id="@+id/childView"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/nav_bar"
        android:padding="5dp"
        android:visibility="gone" >

        <Button
            android:id="@+id/back"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:background="@drawable/title_btn"
            android:paddingLeft="10dp"
            android:paddingRight="10dp"
            android:text="Business"
            android:textColor="@color/white" >
        </Button>

        <TextView
            android:id="@+id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_weight="1"
            android:gravity="center"
            android:text="Image"
            android:textStyle="bold" />

        <ImageButton
            android:id="@+id/call"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/phone" />

        <ImageButton
            android:id="@+id/web"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/web" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" >

        <ImageView
            android:id="@+id/imageView"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" />
    </LinearLayout>

</LinearLayout>

or i should have to use other method to show child layout on Single Tap event of imageButton. Thanks in advance.

  • 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-07T16:18:36+00:00Added an answer on June 7, 2026 at 4:18 pm

    Have a boolean, Make it true on first click, and if user click again check if the boolean is true, then do what you want to do in double click.

    You can define a time suppose 30 ms if user clicks again in you do what you want to do in double click else you can perform operation for single click.

    But in Android we do single click and Long click/press, Long press can replace double click thing. And even long press is recommended instead of double click.

    Here is same answer asked before, see the link >> here

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

Sidebar

Related Questions

I have one ImageButton in my xml layout like that : <ImageButton android:id=@+id/tabsButton android:background=@drawable/button
I have a one table question_table and one ImageButton ( Back ). I need
I have one model User and will be creating another one Category . Both
I have one table which contains events and dates, and another which contains the
In one of my activities I have an ImageButton that on click changes the
I have two ImageButtons, and I am trying to stack one on top of
I have follow this post to make ImageButton in android android image button The
Can some one tell me were i am going wrong. i have three activity's
I have a RelativeLayout in which i have one ImageButton. I need the position
Hello I have one ImageButton with single image. I have added onclick event and

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.