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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:44:45+00:00 2026-05-26T03:44:45+00:00

what I have now is a listView with 3 items in it: Audience, Choosing

  • 0

what I have now is a listView with 3 items in it: Audience, Choosing topics, and Interviewing strategies. I want to be able to save these items as strings to open url with associated item name in the path, but the problem comes when the path has a different item name than the one I have in the listview items; we have Audience, Choosing_topics, and Interviewing as their names. How would I go about dealing away with this conflict in name without changing the names of the url or the listViewItem? Should I refer to another string array to compare the value of the first string array to to retrieve the associated item in the new array? Here’s what I have as of now:

setListAdapter(new ArrayAdapter(this, R.layout.list_item, GREATESTHITS));
ListView lv = getListView();
lv.setTextFilterEnabled(true);

    lv.setOnItemClickListener(new OnItemClickListener() {
      public void onItemClick(AdapterView<?> parent, View view,
          int position, long id) {
          String text = (String) ((TextView)view).getText();
          ((GlobalVariables)getApplication()).setGlobalVariable(text);
     String str = DownloadText("http://www.jmu.edu/uwc/" + text + ".html"); 



static final String[] GREATESTHITS = new String[] {"Audience", "Choosing topics", "Interviewing Strategies"};
  • 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-26T03:44:45+00:00Added an answer on May 26, 2026 at 3:44 am

    I’d say the best way to deal with this is to use objects. You create a model for each of your strings on your GREATESTHITS. You can then add another property for the url or whatever extra you want.

    After that is created, you create and ArrayAdapter<YourTypeHere> and on the ListView you can set the adapter you just created.

    After that on the ItemClickListener you can use this:

    YourTypeHere item = (YourTypeHere) parent.getItemAtPosition(position);
    

    there you have the object on the array, and you can access all the properties you’ve set for that object.

    This seems a little bit overkill for only 3 items, but it is the right way to go.

    On an easier approach you can set a HashMap<String, String> urlNames, add a hash with each text and it’s relative url. After that, on the listener you can do

    String text = (String) ((TextView)view).getText();
          ((GlobalVariables)getApplication()).setGlobalVariable(text);
    String str = DownloadText("http://www.jmu.edu/uwc/" + urlNames.get(text) + ".html"); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A have a ListView that is rendered with multiple items. Now I want to
i have a listview,now i want to perform on each listview items.I am using
i have the files situated in the listview now i want to copy those
I have a ListView that is filled with items of an ArrayAdapter. Now I
I have another problem with ListView :( Now I need to move items in
I have a listview with a big list of items. Now I have a
I used Listview.items.item[X].caption for changing the first column in a listbox,but now I have
I have created a ListView where I have to add different items. Now, when
Hey all, I have a winforms virtualized Listview that i want to be able
Hi i am displaying items according to different categories using Expandable Listview.Now I want

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.