android


How to display Nested HashMap objects to a RecyclerView?


I am having an using to trying to display data to a RecyclerView. Actually I want to display 3 different objects from different HashMap to a RecyclerView but if I kind of know how to do it with 1 it might get how to do it.
The way that the json is formatted I had to use HashMaps. Check it out
where you use see round colors that are the data I need
Now I don't know if I made the Modelclasses wrong but here are they down here and they work because I can get the right data to display on a log file I just dont know how to put it in a RecyclerView I removed some info in the Model class Movie class down here as you can see they are not important and would just make the page long.
public class Movie implements Parcelable {
#SerializedName("pid")
String movieId;
#SerializedName("idioma")
HashMap<String, MovieLanguage> movielanguages;
public Movie() {
}
public Movie(String movieId, HashMap<String, MovieLanguage> movielanguages) {
this.movieId = movieId;
this.movielanguages = movielanguages;
}
public String getMovieId() {
return movieId;
}
public void setMovieId(String movieId) {
this.movieId = movieId;
}
public HashMap<String, MovieLanguage> getMovieLanguage() {
return movielanguages;
}
public void setMovieLanguage(HashMap<String, MovieLanguage> movielanguages) {
this.movielanguages = movielanguages;
}
Another model class:
public class MovieLanguage implements Parcelable {
#SerializedName("formatos")
HashMap<String, MovieFormat> movieformats;
public HashMap<String, MovieFormat> getMovieFormat() {
return movieformats;
}
public void setMovieFormat(HashMap<String, MovieFormat> movieformats) {
this.movieformats = movieformats;
}
Here is another model class:
public class MovieFormat implements Parcelable {
#SerializedName("fechas")
HashMap<String, MovieDate> moviedates;
public HashMap<String, MovieDate> getMovieDate() {
return moviedates;
}
public void setMovieDate(HashMap<String, MovieDate> moviedates) {
this.moviedates = moviedates;
}
Here is the last model class:
public class MovieFunction implements Parcelable {
#SerializedName("session-status")
String functionStatus;
#SerializedName("session-time")
String functionTime;
public String getFunctionStatus() {
return functionStatus;
}
public void setFunctionStatus(String functionStatus) {
this.functionStatus = functionStatus;
}
public String getFunctionTime() {
return functionTime;
}
public void setFunctionTime(String functionTime) {
this.functionTime = functionTime;
}
Here is the code I use in a activity to get the log of the right info I need to display . I just need someone to point /help me in the right direction to display them in a RecyclerView.
for (Map.Entry<String, MovieLanguage> entry : mymovie.getMovieLanguage().entrySet()){
HashMap<String, MovieFormat> movieformatw = entry.getValue().getMovieFormat();
for (Map.Entry<String, MovieFormat> entry2 : movieformatw.entrySet()) {
HashMap<String, MovieDate> moviedatesw = entry2.getValue().getMovieDate();
Log.d("Header", entry.getKey()+ " " + entry2.getKey());
for (Map.Entry<String, MovieDate> entry3 : moviedatesw.entrySet()){
HashMap<String, MovieFunction> moviefunctionsw = entry3.getValue().getMovieFunction();
if(entry3.getKey().contains(today)){
// checks if date is today and display data
for(Map.Entry<String, MovieFunction> entry4 : moviefunctionsw.entrySet()){
Log.d("movietimes ", "" + entry4.getValue().getFunctionTime());
}
}
else{
// there are currently no movie for today do nothing
}
}
}
}
If I run the code above I get the following data what is right what I need to display in a RecyclerView also in the correct way
D/header: Subt Spanish DBOX-2D
D/movietimes: 7:00PM
D/movietimes: 9:30PM
D/movietimes: 4:30PM
D/movietimes: 2:00PM
D/header: Subtitulada DBOX-2D
D/movietimes: 7:00PM
D/movietimes: 9:30PM
D/movietimes: 4:30PM
D/movietimes: 2:00PM
D/header: DBOX DBOX-2D
D/movietimes: 7:00PM
D/movietimes: 9:30PM
D/movietimes: 4:30PM
D/movietimes: 2:00PM

Related Links

Android EPUBLIB read/load content
Stop Google maps navigation programmatically
Android: listview crashes
how to call a java class from OnItemClick()?
android: Determine security type of wifi networks in range (without connecting to them)
Dynamic UI ListView
Android MediaPlayer not working on Samsung phones or tablets
How does Browser (and some other apps) intercept the the Back key before my IME?
Gracefully handle IOException inside AsyncTask?
Taking too much time to finish the Activity in Android?
Broadcast message from Desktop PC to Android Device using WIFI connectivity
Access closed cursor / AsyncTask
How to access resources (like sound, images etc) directly from native code using Android-NDK?
onActivityResult not called in Android
Battery drain while listening to network location updates
Android 3D Game Development

Categories

HOME
android
cygwin
fabricjs
azure-stream-analytics
gridview
wakanda
nested-if
babeljs
jtextpane
crystal-lang
barcode
extjs4.2
google-schemas
minecraft-forge
dkim
php-5.6
nancy
eip
dynamic-sql
red5
cfml
breadth-first-search
squashfs
exit
game-theory
tiki-wiki
opentk
appirater
ms-access-web-app
outliers
linked-data
quantlib
comparable
cppreference
winpe
panoramas
utorrent
cognos-bi
laravel-eloquent
gnat-gps
installshield-le
dynamic-jasper
pop3
indy10
engine.io
projects-and-solutions
chef-solo
resolution
watchface
smoothstate.js
clang++
vaadin-charts
strftime
nanoc
openal
lampp
term
reportservice2010
corruption
aquamacs
custom-font
subnet
avx
rocks
preprocessor
gogs
nservicebus5
nss
redis-cluster
nio2
mobiledoc-kit
inf
grgit
gocql
vigenere
oracle-spatial
coda
teamcity-9.1
diff3
grouping-sets
viewer
device-tree
tinyxml
mysql-error-1044
neos-server
time.h
mkv
appjs
oracle-enterprise-linux
virtualpathprovider
convention
saxparseexception
matlab-load
event-receiver
spread
visualj#
sun
complex-event-processing
lemmatization

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile