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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:15:27+00:00 2026-05-30T22:15:27+00:00

As the title says really.. I have a list view with 3 text view’s

  • 0

As the title says really.. I have a list view with 3 text view’s in it, see below.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:padding="20dp" >

    <TextView
        android:id="@+id/text1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:textColor="#000"
        android:textSize="20dp"
        android:textStyle="bold" />

    <TextView
        android:id="@+id/text2"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:textSize="12sp"
        android:textStyle="bold" />

    <TextView
        android:id="@+id/text3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="14sp"
        android:textStyle="italic"
        android:typeface="sans" />

</LinearLayout>

This is how I call it.

public void displayResultList(ArrayList<HashMap<String, String>> results2) {
    // TODO Auto-generated method stub

    lv = (ListView) findViewById(android.R.id.list);
    SimpleAdapter adapter = new SimpleAdapter(this, results2,
            R.layout.custom_row_view,
            new String[] { "Ear", "Breed", "Sex" }, new int[] { R.id.text1,
                    R.id.text2, R.id.text3 });

    lv.setAdapter(adapter);

}

and this is how I try to retrieve the text, but this doesn’t work..

protected void onListItemClick(ListView l, View v, int position, long id) {
        // TODO Auto-generated method stub
        super.onListItemClick(l, v, position, id);

        String item = (String) ((TextView) v).getText();

        Toast toast3 = Toast.makeText(this, "items = " + item,
                Toast.LENGTH_SHORT);
        toast3.show();

        // Intent mainIntent3 = new Intent(this,CowDetailsActivity.class);
        // mainIntent3.putExtra("cow", item.substring(10, 16));
        // startActivity(mainIntent3);

    }

Can anybody tell me how I can get the first line of text?

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-05-30T22:15:28+00:00Added an answer on May 30, 2026 at 10:15 pm

    Can anybody tell me how I can get the first line of text?

    ((HashMap<String, String>)l.getItemAtPosition(position) will give you your HashMap. I don’t know what “the first line of text” is.

    Or, if you still have results2 held somewhere, results2.get(position) will also return to you your HashMap.

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

Sidebar

Related Questions

Pretty much what the title says really. We have some code that is .NET
As the title says really <td><%= Html.DropDownList(Weight, Model.Weightddl.Select(x => new SelectListItem { Text =
What the title says, really. I have a named pipe. I would like to
Basically, what the title says. I have several properties that combine together to really
The title sort of says it all. I have a text file (NOT a
Erm... what the title says really; I have a PHP script executed by an
Basically, what the title says. I have several properties that combine together to really
As the title says really. Does the virtual keyword cause a performance hit?
Question title says it all really - a lot slower than VS2005, with a
As the title says, the java.io.tmpdir property in Java is really nice, and I

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.