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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:29:53+00:00 2026-05-15T03:29:53+00:00

I’m just getting my feet wet with Android and have built a UI that

  • 0

I’m just getting my feet wet with Android and have built a UI that contains a TabHost with three tabs. Each tab is powered by its own Activity. The first Tab contains a listview with a prepopulated set of rows and is built from a custom ArrayAdapter.

The problem I’m running into is that none of the ListView rows are tappable. In other words, when I tap on them there is no orange selection. If I use the scroll ball on my Nexus One it will select, but any touch gestures don’t seem to be responding.

All the UI is being handled using XML files with a main.xml housing the TabHost -> LinearLayout -> TabWidget/FrameLayout and a nearby_activity.xml file containing my ListView UI

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

  <ListView 
    android:id="@android:id/list" 
    android:layout_width="fill_parent" 
    android:layout_height="0dip" 
    android:layout_weight="1.0"
    android:choiceMode="multipleChoice"
    android:divider="#d9d9d9"
    android:dividerHeight="1px"    
    android:cacheColorHint="#eee"  
  />  
</LinearLayout>

And the relevant code from my Activity that is set to show in the selected tab.

public class NearbyActivity extends ListActivity
{
    private ArrayList<Event> m_events = null;
    private EventAdapter m_adapter = null;

    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.nearby_activity);

            getEvents();
        this.m_adapter = new EventAdapter(this, R.layout.eventrow, m_events);
        setListAdapter(this.m_adapter);
    }

    private void getEvents() 
    {
        m_events = new ArrayList<Event>();

        for (int i = 0; i < 100 ; i++)
        {
            Event e = new Event();
            e.setEventName("Event " + i);
            e.setVenueName("Staples Center");
            e.setStartDate(new Date());
            m_events.add(e);
        }
    }

    private class EventAdapter extends ArrayAdapter<Event>
    {
        private ArrayList<Event> items;

    public EventAdapter(Context context, int textViewResourceId, ArrayList<Event> items) 
    {
        super(context, textViewResourceId, items);
        this.items = items;
    }

    @Override
    public View getView (int position, View convertView, ViewGroup parent)
    {
      View v = convertView;
      if (v == null) 
      {
          LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
          v = vi.inflate(R.layout.eventrow, null);
      }


      Event e = items.get(position);        
      if (e != null) 
      {
        TextView nameText = (TextView)v.findViewById(R.id.eventName);
        TextView venueNameText = (TextView)v.findViewById(R.id.venueName);
        if (nameText != null) 
        {
            nameText.setText(e.getEventName());                            
        }

        if(venueNameText != null)
        {
            venueNameText.setText(e.getVenueName());
        }
      }

      return v;
    }
    }
}

My listview row’s are populated by an XML file as well.

<?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="?android:attr/listPreferredItemHeight"
  android:orientation="vertical"
  android:padding="4dip">

  <TextView
    android:id="@+id/eventName"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:inputType="text"
    android:singleLine="true"
    android:ellipsize="marquee"
    android:textSize="18sp"
    android:textColor="#000"
   />

  <TextView
    android:id="@+id/venueName"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@id/eventName"    
    android:layout_alignParentBottom="true"
    android:layout_marginRight="55dip"    
    android:singleLine="true"
    android:ellipsize="end"
    android:scrollHorizontally="true"
    android:textSize="13sp"
    android:textColor="#313131"
    android:layout_alignWithParentIfMissing="true"
    android:gravity="center_vertical"
   />      

</RelativeLayout>

Thanks for any help you can offer.

  • 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-15T03:29:54+00:00Added an answer on May 15, 2026 at 3:29 am

    You want a Listview tappable, well you need implement the method onListItemClick()

        @Override
        protected void onListItemClick(ListView l, View v, final int position, long id) {
        super.onListItemClick(l, v, position, id);                 
    Toast.makeText(this,  "This is my row number " + position,Toast.LENGTH_LONG).show();
        }
    

    and to ensure the orange colour you must set the property

    android:focusable="false"
    

    in your Listview Row.xml

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

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a jquery bug and I've been looking for hours now, I can't
Basically, what I'm trying to create is a page of div tags, each has
I've got a string that has curly quotes in it. I'd like to replace

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.