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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T15:36:59+00:00 2026-06-07T15:36:59+00:00

I’ve followed this tutorial and I am not able to figure out why the

  • 0

I’ve followed this tutorial and I am not able to figure out why the emulator is not showing the items.

Here’s my ListActivity:

public class MyListActivity extends ListActivity {

private Timer myTimer;
private boolean SetTimerOnResume=false;

private ArrayList<HashMap<String,String>> chat=new ArrayList<HashMap<String,String>>();

private LazyAdapter adapter;

static final String Key_username="username_key";
static final String Key_email="email_key";
static final String Key_messageText="messageText_key";
static final String Key_messageDate="messageDate_key";

     @Override
      public void onCreate(Bundle savedInstance) {
         super.onCreate(savedInstance);
            setContentView(R.layout.lists);

            HttpRequest httpRequest=new HttpRequest("ReturnNewChatsToAdmin", "admin", "You" , "zawalarsa", "muazzamalii@hotmail.com");  
            String data=httpRequest.ExecuteRequest();
            httpRequest.ExecuteRequest();

            try {

                 JSONArray jsonarr=new JSONArray(data);

                for(int i=0;i<jsonarr.length();i++)
                {   
                    HashMap<String,String> hashMap=new HashMap<String,String>();

                    hashMap.put(MyListActivity.Key_username, jsonarr.getJSONObject(i).getString("username"));
                    hashMap.put(MyListActivity.Key_email, jsonarr.getJSONObject(i).getString("email"));
                    hashMap.put(MyListActivity.Key_messageText, jsonarr.getJSONObject(i).getString("chatText"));
                    hashMap.put(MyListActivity.Key_messageDate, jsonarr.getJSONObject(i).getString("chatDate"));

                    chat.add(hashMap);

                }

            ListView lv=(ListView)findViewById(android.R.id.list);
            adapter=new LazyAdapter(this,chat);
            lv.setAdapter(adapter);

          lv.setOnItemClickListener(new OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> parent, View view,int position, long id) {

            }
          });

            }
            catch(JSONException e)
            {
            }
     }

}

and here’s the lazyadapter as shown in the tutorial:

package com.app.ServerClient;

public class LazyAdapter extends BaseAdapter{

private Activity activity;
private ArrayList<HashMap<String,String>> hashmap;
private static LayoutInflater inflater=null;

public LazyAdapter(Activity activity,ArrayList<HashMap<String,String>> hashMaps)
{
    this.activity=activity;
    this.hashmap=hashMaps;
    LazyAdapter.inflater=(LayoutInflater)this.activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}

@Override
public int getCount() {
    return hashmap.size();
}

@Override
public Object getItem(int position) {
    return position;
}

@Override
public long getItemId(int position) {
    return position;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {

    View view=convertView;

    if(convertView==null)
        view=inflater.inflate(R.layout.list_layout,null);

    TextView username=(TextView)view.findViewById(R.id.username);
    TextView email=(TextView)view.findViewById(R.id.email);
    TextView messageDate=(TextView)view.findViewById(R.id.chatdate);
    TextView messagetext=(TextView)view.findViewById(R.id.messagetext);

    HashMap<String,String> map=new HashMap<String, String>();
    hashmap.get(position);

    username.setText(map.get(MyListActivity.Key_username));
    email.setText(map.get(MyListActivity.Key_email));
    messageDate.setText(map.get(MyListActivity.Key_messageDate));
    messagetext.setText(map.get(MyListActivity.Key_messageText));

    return view;
}


}

and here’s my list_item.xml:

<?xml version="1.0" encoding="utf-8"?>


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


 <LinearLayout
 android:layout_width="fill_parent"
 android:layout_height="wrap_content"
 android:orientation="horizontal" >

 <TextView
     android:id="@+id/username"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:layout_weight="11.74"
     android:textColor="#FFFF00"
     android:textSize="17sp"
     android:textStyle="bold"
      />

 <TextView
     android:id="@+id/chatdate"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:layout_weight="11.74"
     android:textColor="#FFFF00"
     android:textSize="17sp"
     android:textStyle="bold"
     />

 </LinearLayout>

 <TextView
 android:id="@+id/email"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
  />

 <TextView android:id="@+id/message" 
 android:layout_width="wrap_content" 
 android:layout_height="wrap_content"
 android:text="@string/Message"
 android:textStyle="bold"/>

<TextView android:id="@+id/messagetext" 
 android:layout_width="wrap_content" 
 android:layout_height="wrap_content"
 />

</LinearLayout>

Here’s the output:

  • 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-07T15:37:01+00:00Added an answer on June 7, 2026 at 3:37 pm

    Change those rows

    HashMap<String,String> map=new HashMap<String, String>();
    hashmap.get(position);
    

    in

    HashMap<String,String> map= hashmap.get(position);
    

    an it will work

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

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I am doing a simple coin flipping experiment for class that involves flipping a
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
public static bool CheckLogin(string Username, string Password, bool AutoLogin) { bool LoginSuccessful; // Trim

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.