java - ListView Not Showing Up -


i trying listview display, not. have read through other posts , unable find problem.

here snippet set adapter. have checked debugger , not set null afterwards.

tournaments = (arraylist) datasnapshot.getvalue();                 adapter = new arrayadapter(admincontrol.this, android.r.layout.simple_list_item_1, tournaments);                 list.setadapter(adapter); 

here xml content file:

 <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:paddingbottom="@dimen/activity_vertical_margin"     android:paddingleft="@dimen/activity_horizontal_margin"     android:paddingright="@dimen/activity_horizontal_margin"     android:paddingtop="@dimen/activity_vertical_margin"     app:layout_behavior="@string/appbar_scrolling_view_behavior"     tools:context="com.example.kaushikshivakumar.vexteamqueuing.admincontrol"     tools:showin="@layout/activity_admin_control"     android:background="#ffffff">   <listview     android:layout_width="wrap_content"     android:layout_height="fill_parent"     android:id="@+id/listview"     android:layout_alignparenttop="true"     android:layout_alignparentleft="true"     android:layout_alignparentstart="true"     android:layout_marginbottom="30dp" /> </relativelayout> 

here xml activity file - activity_admin_control

<?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true" tools:context="com.example.kaushikshivakumar.vexteamqueuing.admincontrol" app:theme = "@style/noactionbar">  <android.support.design.widget.appbarlayout     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:theme="@style/noactionbar">      <android.support.v7.widget.toolbar         android:id="@+id/toolbar"         android:layout_width="match_parent"         android:layout_height="?attr/actionbarsize"         android:background="?attr/colorprimary"         app:popuptheme="@style/apptheme.popupoverlay"         />  </android.support.design.widget.appbarlayout>  <android.support.design.widget.floatingactionbutton     android:id="@+id/fab"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_gravity="bottom|end"     android:layout_margin="@dimen/fab_margin"     android:src="@android:drawable/ic_input_add"     android:onclick="createnewtournament"     android:clickable="true" />   </android.support.design.widget.coordinatorlayout> 

my entire activity class:

package com.example.kaushikshivakumar.vexteamqueuing;  import android.app.actionbar; import android.content.intent; import android.provider.contactscontract; import android.support.design.widget.floatingactionbutton; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.support.v7.widget.toolbar; import android.view.view; import android.widget.arrayadapter; import android.widget.listadapter; import android.widget.listview; import android.widget.textview;  import com.firebase.client.datasnapshot; import com.firebase.client.firebase;   import java.lang.object.*;  import com.firebase.client.firebaseerror; import com.firebase.client.valueeventlistener; import com.firebase.client.authentication.*; //import com.firebase.ui.database.firebaselistadapter;  import java.lang.reflect.array; import java.util.arraylist; import java.util.list;  public class admincontrol extends appcompatactivity { firebase ref; floatingactionbutton fab; public static list <tournament> tournaments; public static datasnapshot currentsnap; arrayadapter adapter; listview list; @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_admin_control);     toolbar b = (toolbar) findviewbyid(r.id.toolbar);     b.settitle("tournaments");     setsupportactionbar(b);     list = (listview) findviewbyid(r.id.listview);     fab = (floatingactionbutton) findviewbyid(r.id.fab);     fab.setonclicklistener(new view.onclicklistener() {         public void onclick(view v) {             createnewtournament(v);         }     });     ref = adminlogin.firebase.child("users").child(adminlogin.firebase.getauth().getuid());     ref.addvalueeventlistener(new valueeventlistener() {         @override         public void ondatachange(datasnapshot datasnapshot) {             if (datasnapshot.getvalue() != null){                 tournaments = (arraylist) datasnapshot.getvalue();                 adapter = new arrayadapter(admincontrol.this, android.r.layout.simple_list_item_1, tournaments);                 list.setadapter(adapter);             }             else{                 tournaments = new arraylist<>();                 adapter = new arrayadapter(admincontrol.this, android.r.layout.simple_list_item_1, tournaments);                 list.setadapter(adapter);             }              currentsnap = datasnapshot;         }          @override         public void oncancelled(firebaseerror firebaseerror) {          }     }); }  public void createnewtournament(view v) {     if (tournaments == null){         system.out.println(tournaments);     }     intent newintent = new intent(this, tournamentcreator.class);     startactivity(newintent); } 

}

you need include content file inside activity_admin_control.xml. right nothing points content file. activity doesn't know exists.


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -