2017-02-13 5 views
0

Вот код, я использую прямо сейчас:метод ArrayList для списка с подкатегорий

public void onDataChange(DataSnapshot dataSnapshot) { 

      for (DataSnapshot moviecatlog: dataSnapshot.getChildren()) { 
       Actors = (String) moviecatlog.child("Actors").getValue(); 
       Description = (String) moviecatlog.child("Description").getValue(); 
       Director = (String) moviecatlog.child("Director").getValue(); 
       Genre = (String) moviecatlog.child("Genre").getValue(); 
       Published = (String) moviecatlog.child("Published").getValue(); 
       MovieUrl = (String) moviecatlog.child("MovieUrl").getValue(); 
       Status = (String) moviecatlog.child("Status").getValue(); 
       ThumbUrl = (String) moviecatlog.child("ThumbUrl").getValue(); 
       Title = (String) moviecatlog.child("Title").getValue(); 
       id = (String) moviecatlog.child("id").getValue(); 


//     recyclerView.setAdapter(new RecyclerViewAdapter(moviecatlog)); 

       ar = new ArrayList<String>(); 

       ar.add(Actors); 
       ar.add(Description); 
       ar.add(Director); 
       ar.add(Genre); 
       ar.add(MovieUrl); 
       ar.add(Published); 
       ar.add(Status); 
       ar.add(ThumbUrl); 
       ar.add(Title); 
       ar.add(id); 

       recyclerView.setAdapter(new RecyclerViewAdapter(ar)); 

thats the structure I have at firebase.

Как поместить эти данные в ArrayList? Прямо сейчас, я могу сразу поместить все данные, но в конце он показывает только свойства последнего элемента в ArrayList.

+0

пожалуйста перефразировать свой вопрос не ясно. –

+1

Я хочу поместить все эти данные, показанные выше в arraylist, и я не знаю, как создать новый arraylist после того, как предыдущий завершится со всеми тегами – user3921943

+0

, пожалуйста, прочитайте, как сформулировать четкий вопрос по стандартам SO и переписать свой вопрос. Вам нужно приложить еще больше усилий для формулирования вашего вопроса. –

ответ

1
Arraylist actor=new Arraylist(); 
     notification = new ArrayList<HashMap<String, String>>(); 
     notification1 = new ArrayList<HashMap<String, String>>(); 

     HashMap<String, String> list = new HashMap<String, String>; 
      actoredata[]={om puri ,raj,}; 
      directore[]={mahesh bhatt,payrelal}; 
      for(i=0;i<actoredatalenth(),i++){ 


      list.put("actor", actore[i]))); 
     notification.add(list); 
      } 
      actore.add(notification); 
      for(i=0;i<directorelenth(),i++){ 


      list.put("actor", directore[i]))); 
     notification.add(list); 
      }actore.add(notification); 

enter image description here

+1

использовать для lopp, если у вас есть больше данных –

+0

Я обновил свой вопрос/ – user3921943

+0

plz очистить свой вопрос, что хотите –

Смежные вопросы