TextView inside FirebaseListAdapter

1

When declaring a FirebaseListAdapter you can use a view to show the
data within the ListView to which the adapter is set. But when placing a TextView for example here.

    Firebase cursosRef = rootRef.child("NRC");  
    FirebaseListAdapter<String> adapterFire = new   FirebaseListAdapter<String>  (this,String.class,android.R.layout.simple_list_item_1,cursosRef) {  
        @Override  
        protected void populateView(View view, String s, int i) {  
            TextView text = (TextView)view.findViewById(R.id.text1);  
            text.setText(s);  
        }  
    };  
}  

The layout that goes inside the findViewById parameters ... In what part of the XML should I create it?

    
asked by Parzival 26.05.2016 в 02:18
source

2 answers

0

Where do you want to place the TextView exactly? Inside the adapter to load a ListView or a GridView?

If so, you will have to create your custom adapter by extending the Firebase class and assign it a custom layout in which you will include your TextView.

If you want an example or guidance, this GitHub repository will be very helpful:

link

    
answered by 31.05.2016 в 08:42
0

It is similar to an Activity, it is done within the onCreate() method:

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
...
...

This is where you assign the layout that will contain your elements, in this case your TextView.

    
answered by 04.12.2016 в 14:06