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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:37:46+00:00 2026-06-17T19:37:46+00:00

i have a listview with relativelayout header, when i click on any space in

  • 0

i have a listview with relativelayout header, when i click on any space in the relativelayout it becomes white, i don’t want that white, if the user click on the space, nothing will happend, but if he clicks on the image into that relativelayout there is action i can handle it in onclick.

this is the relative layout

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:id="@+id/rl_simple_list_item_header"
    android:focusable="true"
    android:orientation="horizontal" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/orderMeal"
        android:layout_marginLeft="20dip"
        android:id="@+id/tv_restaurant_description_orderMeal"
        android:drawableTop="@drawable/order_meal" />
    <TextView 
        android:id="@+id/iv_simple_list_item_header_favorite"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/favorite"
        android:layout_alignParentRight="true"
        android:layout_marginRight="20dip"
        android:drawableTop="@drawable/favorite"/>
</RelativeLayout>

edit

01-25 21:00:42.718: E/AndroidRuntime(24121): FATAL EXCEPTION: main
01-25 21:00:42.718: E/AndroidRuntime(24121): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.Syriatel.EatTel/com.Syriatel.EatTel.Restaurant_Description}: java.lang.NullPointerException
01-25 21:00:42.718: E/AndroidRuntime(24121):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1659)
01-25 21:00:42.718: E/AndroidRuntime(24121):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1675)
01-25 21:00:42.718: E/AndroidRuntime(24121):    at android.app.ActivityThread.access$1500(ActivityThread.java:121)
01-25 21:00:42.718: E/AndroidRuntime(24121):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:943)
01-25 21:00:42.718: E/AndroidRuntime(24121):    at android.os.Handler.dispatchMessage(Handler.java:99)
01-25 21:00:42.718: E/AndroidRuntime(24121):    at android.os.Looper.loop(Looper.java:130)
01-25 21:00:42.718: E/AndroidRuntime(24121):    at android.app.ActivityThread.main(ActivityThread.java:3701)
01-25 21:00:42.718: E/AndroidRuntime(24121):    at java.lang.reflect.Method.invokeNative(Native Method)
01-25 21:00:42.718: E/AndroidRuntime(24121):    at java.lang.reflect.Method.invoke(Method.java:507)
01-25 21:00:42.718: E/AndroidRuntime(24121):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
01-25 21:00:42.718: E/AndroidRuntime(24121):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624)
01-25 21:00:42.718: E/AndroidRuntime(24121):    at dalvik.system.NativeStart.main(Native Method)
01-25 21:00:42.718: E/AndroidRuntime(24121): Caused by: java.lang.NullPointerException
01-25 21:00:42.718: E/AndroidRuntime(24121):    at com.Syriatel.EatTel.Restaurant_Description.initialize(Restaurant_Description.java:46)
01-25 21:00:42.718: E/AndroidRuntime(24121):    at com.Syriatel.EatTel.Restaurant_Description.onCreate(Restaurant_Description.java:35)
01-25 21:00:42.718: E/AndroidRuntime(24121):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
01-25 21:00:42.718: E/AndroidRuntime(24121):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1623)
01-25 21:00:42.718: E/AndroidRuntime(24121):    ... 11 more
  • 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-17T19:37:48+00:00Added an answer on June 17, 2026 at 7:37 pm

    Try to make your RelativeLayout focusable:

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/rl_simple_list_item_header"
        android:orientation="horizontal"
        android:focusable="true"
        android:focusableInTouchMode="true" >
    

    UPDATE

    If you want clickable TextView inside your header you can do it this way:

    View header = LayoutInflater.from(this).inflate(R.layout.simple_list_item_header, null);
    View favorite = header.findViewById(R.id.iv_simple_list_item_header_favorite);
    
    lv_restaurantInformation = (ListView) findViewById(R.id.lv_restaurant_description_information);
    lv_restaurantInformation.addHeaderView(header);
    
    favorite.setOnClickListener(this);
    

    And then handle it in onClick method of the Activity:

    @Override
    public void onClick(View v) {
        // TODO Auto-generated method stub
        switch (v.getId()) {
        case R.id.iv_simple_list_item_header_favorite:
            Toast.makeText(this, "onClick", Toast.LENGTH_SHORT).show();
            break;
    
        default:
            break;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a RelativeLayout for a row that goes inside a ListView . The
I have a rather simple ListView row: <?xml version=1.0 encoding=utf-8?> <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent android:layout_height=wrap_content
I have listview control.There is an option to remove selected items.After the user removes
I have listview having customized some textview and one imageview. When I long click
I have ListView that has the following EditItemTemplate: <EditItemTemplate> <tr style=> <td> <asp:LinkButton ID=UpdateButton
I have ListView that uses a GridView to display several columns of data. Two
I have a ListView with Horizontal WrapPanel as its ItemsPanelTemplate. I want to get
I have layout like this At the top i have listView ,below that i
I have a ListView, and I want to customize the layout of each item
I have a RelativeLayout with ListView : <?xml version=1.0 encoding=utf-8?> <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android android:id=@+id/container android:layout_width=fill_parent

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.