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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:51:34+00:00 2026-06-13T23:51:34+00:00

I use include XML. I do not want to set each activity setOnItemClickListener. My

  • 0

I use “include” XML. I do not want to set each “activity” setOnItemClickListener.

My “include” XML food.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/foot"
    android:layout_width="fill_parent"
    android:layout_height="36dp"
    android:layout_alignParentBottom="true"
    android:background="#292929"
    android:gravity="right|center_vertical"
    android:padding="5dp" >

    <ImageView
        android:id="@+id/imageView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginRight="15dp"
        android:src="@drawable/categories" />
</LinearLayout>

and where I set him

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#595858"
    android:gravity="top" >

    <ScrollView
        android:id="@+id/scrollView1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_above="@+id/foot">

    <include
        android:layout_alignParentBottom="true"
        layout="@layout/foot" />

</RelativeLayout>

every time the my activity uses “foot” I set on my image “setOnItemClickListener”

I want to set only once setOnItemClickListener

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-06-13T23:51:36+00:00Added an answer on June 13, 2026 at 11:51 pm

    Make all your activities inherit from a base activity class that will set the listener if the imageview with the appropriate ID exists:

    public class MyBaseActivity extends Activity {
        public onStart() {
          super.onStart();
          ImageView clickableImageView = (ImageView) findViewById(R.id.imageView3);
          if (clickableImageView!=null) clickableImageView .setOnClickListener(myClickListener);
        }
    
        private OnClickListener myClickListener = new OnClickListener() {
          // ...
        };
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I try to use #include CFIS_Main.h statement in form For_Student_Details.h, Its not accepting...Anybody
I want to use identity template to transform XML->XML, while excluding certain nodes. Those
I want to document my source (C# sources), indeed I use XML documentation tags
I want to use @cacheable annotations on objects that are not managed by spring.
I have a text file i want to include in my Android application, it
Here i am using scrollview in my linearlayout.But i want to include another listview
Here is my code #!usr/bin/env perl # Setup includes use strict; use XML::RSS; use
I have an XML document that includes XPath expressions that I need to use
Possible Duplicate: How to use include within a function? i have two file inc.php
I have use include ('base.php') script in my other scripts ( more.php ). Now

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.