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

  • Home
  • SEARCH
  • 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 8358685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T10:52:53+00:00 2026-06-09T10:52:53+00:00

currently i’m studying the setListAdapter, and have come across 2 snippets of code below.

  • 0

currently i’m studying the setListAdapter, and have come across 2 snippets of code below.

Snippet 1:

ArrayAdapter<String> adapter =
    new ArrayAdapter<String>(this, R.layout.layout_nm, R.id.layout_idnm, items);
setListAdapter(adapter);

Snippet 2:

setListAdapter(new ArrayAdapter<String>(this, R.layout.layout_nm, R.id.layout_idnm, items););   

my question is:

  1. do both snippets have the same meaning?
  2. does the second snippet define ArrayAdapter?
  • 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-09T10:52:54+00:00Added an answer on June 9, 2026 at 10:52 am

    1. There is an extra ";" in the 2nd option, so remove it…

    Before:

    setListAdapter(new ArrayAdapter<String>(this, R.layout.layout_nm, R.id.layout_idnm, items););
    

    After:

    setListAdapter(new ArrayAdapter<String>(this, R.layout.layout_nm, R.id.layout_idnm, items));
    

    2. If you are using the 2nd approach you are NOT creating a local variable, this will create a problem when you will need to refer this ArrayList object again in the code.

    For example you will need this local variable if you want to do something like notifyDataSetChanged()

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

Sidebar

Related Questions

Currently I have this code: <?php echo '<meta name=robots content=noindex>'; $arr = json_decode(file_get_contents(http://media1.clubpenguin.com/play/en/web_service/game_configs/ paper_items.json),true);
Currently I have in my code tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(addCompoundToLabel:)]; My code
Currently i have the following code: This is within my HTML document. <script language=JavaScript
Currently I'm starting a new Activity and calling finish on a current one. Is
Currently, I'm working on a project where I have a server - client relationship
Currently I have 2 ways of displaying images in a cell, which way will
Currently i have a node.js and socket.io application in development on my local machine
Currently, I have: <html> <div class=yes1><span><img src=img></span></div> </html> <script> var x = ='yes1' var
currently I'm developing an app for WP7 but came across a little problem with
currently we have a column with only integer values declared as NUMBER. At the

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.