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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:52:11+00:00 2026-05-20T22:52:11+00:00

private String lv_arr[]={Android,iPhone,BlackBerry,AndroidPeople}; public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.mylist); lv1=(ListView)findViewById(R.id.ListView01); // By using

  • 0
private String lv_arr[]={"Android","iPhone","BlackBerry","AndroidPeople"};

public void onCreate(Bundle icicle)
{
super.onCreate(icicle);
setContentView(R.layout.mylist);
lv1=(ListView)findViewById(R.id.ListView01);
// By using setAdpater method in listview we an add string array in list.
lv1.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1 , lv_arr));


//getListView().setTextFilterEnabled(true);
}



protected void onListItemClick(ListView l, View v, int position, long id) {
    //super.onListItemClick(l, v, position, id);
    Object o = this.getListAdapter().getItem(position);
    String pen = o.toString();


    if (pen.equals("Android"))
    { 
        Intent myIntent = new Intent(v.getContext(), Catedral.class);
    startActivityForResult(myIntent, 0);
    Toast.makeText(this, "Catedral", Toast.LENGTH_LONG).show();
    }
  • 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-20T22:52:12+00:00Added an answer on May 20, 2026 at 10:52 pm

    Calling toString on Object just returns the memory reference of the object. This is why pen does not match.

    I’m not that familiar with ListAdapter, have you tried casting the return to a String before assigning to a reference:

    String pen = (String) this.getListAdapter().getItem(position);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

list_item.java public class List_Items extends ListActivity{ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.list_item); ListView
private String message = ; public String getMessage() { return message; } public void
private string _itemId; [Browsable(true), Description(Required identifier for the Item.)] public string ItemId { get
@Entity public class Blobx { private String name; private BlobKey blobKey; @Id @GeneratedValue(strategy =
Has anyone else seen people do this: private string _name; public string Name{ get{
Consider this: public class TestClass { private String a; private String b; public TestClass()
private class CompAdvertisements : IComparer<Advertisements> { private string OrderBy { get; set; } public
public class List_Items extends ListActivity{ private ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String, String>>(); public
private string? typeOfContract { get { return (string?)ViewState[typeOfContract]; } set { ViewState[typeOfContract] = value;
Consider the following inheritance: abstract class Employee { private string empID; private string empName;

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.