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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:27:00+00:00 2026-05-22T18:27:00+00:00

list_item.xml: http://pastebin.com/bn56L3NN What happens after onCreate() and after creating the Comm-object is that I

  • 0

list_item.xml: http://pastebin.com/bn56L3NN

What happens after onCreate() and after creating the Comm-object is that I get a “Connection established” message which gets picked up in another thread and I get the message in receiveMessage, I then send “list” and get called back to receiveMessage again.

I’ve checked with Log.v and I do get back the message that I want to list, my problem is that I can’t display it in the ListActivity when I get to these lines, maybe I should replace them with something else?:

setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, userRooms));
ListView lv = getListView();
lv.setTextFilterEnabled(true);

Full code:

package elf.app;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import elf.app.comm.CommClient;
import elf.app.comm.CommListener;
import elf.app.entity.ELFList;
import elf.app.entity.Entry;

public class RoomListActivity extends ListActivity implements CommListener {
    private ELFList eList;
    private String[] userRooms;
    private CommClient comm;


    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);


        eList = new ELFList();
        comm = new CommClient(  getIntent().getExtras().getString("ip"),
                                getIntent().getExtras().getInt("port") );
        comm.setListener(this);
        new Thread(comm).start();
    }

    public void receiveMessage(String IP, String message, int id) {
        if(message.equals("Connection established")) {
            comm.send("list");
        }
        if(message.charAt(0)=='#') {
            String[] strArr = toStringarr(message);
            eList.add(strArr);
            listItems();
        }
    }

    public String[] toStringarr(String str) {
        String substr = str.substring(1);
        return substr.split("@");
    }

    public void listItems() {
        userRooms = eList.returnNames();

        setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, userRooms));
        ListView lv = getListView();
        lv.setTextFilterEnabled(true);

        lv.setOnItemClickListener(new OnItemClickListener() {
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

                Entry e = eList.getEntry(position);
                String roominfo = e.toString();

                Intent intent = new Intent(RoomListActivity.this, RoomInfoActivity.class);
                intent.putExtra("entry",roominfo);
                intent.putExtra("ip", getIntent().getExtras().getString("ip"));
                intent.putExtra("port", getIntent().getExtras().getInt("port"));
                comm.disconnect();
                RoomListActivity.this.startActivity(intent);
            }
        });
    }

}
  • 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-22T18:27:01+00:00Added an answer on May 22, 2026 at 6:27 pm

    You forgot to set a content view for your Activity in onCreate() which contains the layout for the Activity. So there is no list to display which could display anything. Define a layout in a layout XML file and set it as content view using setContentView().

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

Sidebar

Related Questions

I wanted to update my layout from <?xml version=1.0 encoding=utf-8?> <TextView xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent android:layout_height=fill_parent
Check the code at http://developer.android.com/resources/tutorials/views/hello-autocomplete.html or <?xml version=1.0 encoding=utf-8?> <TextView xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent android:layout_height=fill_parent android:padding=10dp
I'm trying to get something like this: http://img202.imageshack.us/img202/552/layoutoy.png . I'm using this as a
I have a ListView that inflate for each row a xml that contain a
I have been using the HorizontalListView sample provided at http://www.dev-smart.com/archives/34 . However my list
I have a task list, and have defined each list item in list_item.xml as
I've learned that iTunes XML file is actually a plist, and instead of trying
I am using an horizontal accordion from here: http://www.dynamicdrive.com/dynamicindex17/haccordion.htm I got it to display
I followed the tutorial at: http://mobile.tutsplus.com/tutorials/android/android-listview/ and was able to successfully run the application.
I am follow google's listview tutorial (http://developer.android.com/resources/tutorials/views/hello-listview.html) and I'm trying to ad an adview

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.