java - ListView not working? -


working in group make android app, need create activity consisting of listview displays several selectables (adapted string array) -- listview take array of objects we're making, , depending on objects available on our server @ time, array of objects going change (and thus, entries of listview change). now, need working array of strings.

so, here's activity's xml, , java main.

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:orientation="vertical"     android:layout_width="fill_parent"      android:layout_height="fill_parent"     android:layout_gravity="center">       <listview         android:id="@+id/gameslistview"         android:layout_width="match_parent"         android:layout_height="320dp"         android:entries="@+id/gameslist"      >     </listview>      <button         android:layout_width="fill_parent"         android:layout_height="45dp"          android:text="create"         android:id="@+id/bcreate"     />      <button         android:layout_width="fill_parent"         android:layout_height="45dp"         android:text="refresh"         android:id="@+id/brefresh"     />  </linearlayout> 

package com.youcanthide.android.gamespage;   import android.os.bundle; import android.app.activity; import android.content.intent; import android.view.menu; import android.view.view; import android.widget.arrayadapter; import android.widget.button; import android.widget.listview;  public class mainactivity extends activity {  button create, refresh; //browse string gameslist[] = {"game1", "game2", "game3"};  //game [] games; **********//the array of available games populate slideview  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);     create = (button) findviewbyid(r.id.bcreate);     refresh = (button) findviewbyid(r.id.brefresh);      listview games = (listview) findviewbyid(r.id.gameslistview);      //will have remake adapter game objects     arrayadapter<string> adapter = new arrayadapter<string>(this,    android.r.layout.simple_list_item_1, gameslist);     games.setadapter(adapter); }   @override public boolean oncreateoptionsmenu(menu menu) {     // inflate menu; adds items action bar if present.     getmenuinflater().inflate(r.menu.main, menu);     return true; }  } 

i've been trying follow api , simple tutorials still cant figure out why it's breaking. there's no error messages in eclipse, when run emulator activity gives me "unfortunately (projectname) has stopped". appreciated!

remove line xml:

 android:entries="@+id/gameslist" 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -