I android Daten bin mit Bindung und finden Sie die Klasse, die ich VariableDaten Android Binding Recycler Ansicht
public class DayTemp extends BaseObservable implements Serializable {
@SerializedName("dt")
long date;
@SerializedName("pressure")
double pressure;
@SerializedName("humidity")
long humidity;
@SerializedName("temp")
Temp temp;
@SerializedName("weather")
ArrayList<Weather> weathers;
@SerializedName("speed")
double speed;
@SerializedName("deg")
double deg;
@SerializedName("clouds")
double clouds;
@Bindable
public long getDate() {
return date;
}
public void setDate(long date) {
this.date = date;
notifyPropertyChanged(BR.date);
}
@Bindable
public double getPressure() {
return pressure;
}
public void setPressure(double pressure) {
this.pressure = pressure;
notifyPropertyChanged(BR.pressure);
}
@Bindable
public long getHumidity() {
return humidity;
}
public void setHumidity(long humidity) {
this.humidity = humidity;
notifyPropertyChanged(BR.humidity);
}
@Bindable
public Temp getTemp() {
return temp;
}
public void setTemp(Temp temp) {
this.temp = temp;
notifyPropertyChanged(BR.temp);
}
@Bindable
public ArrayList<Weather> getWeathers() {
return weathers;
}
public void setWeathers(ArrayList<Weather> weathers) {
this.weathers = weathers;
notifyPropertyChanged(BR.weathers);
}
@Bindable
public double getSpeed() {
return speed;
}
public void setSpeed(double speed) {
this.speed = speed;
notifyPropertyChanged(BR.speed);
}
@Bindable
public double getDeg() {
return deg;
}
public void setDeg(double deg) {
this.deg = deg;
notifyPropertyChanged(BR.deg);
}
@Bindable
public double getClouds() {
return clouds;
}
public void setClouds(double clouds) {
this.clouds = clouds;
notifyPropertyChanged(BR.clouds);
}
}
Wie in dieser POJO Klasse I bin in der Lage zu setzen alle Werte auf meine recyclerview bt setzen bin mit Ich kann nicht auf die Wetter-Arraylist zugreifen und auch nicht in der Lage, die damit verbundenen Felder zu bekommen.
public class Weather extends BaseObservable implements Serializable {
@SerializedName("id")
long id;
@SerializedName("main")
String main;
@SerializedName("description")
String desc;
@SerializedName("icon")
String icon;
@Bindable
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
notifyPropertyChanged(BR.id);
}
@Bindable
public String getMain() {
return main;
}
public void setMain(String main) {
this.main = main;
notifyPropertyChanged(BR.main);
}
@Bindable
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
notifyPropertyChanged(BR.desc);
}
@Bindable
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon;
notifyPropertyChanged(BR.icon);
}
}
Layout-Datei:
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
>
<data>
<import type="com.weatherappforleftshift.currentlocation.DateUtils"/>
<variable
name="daytemp" type="com.weatherappforleftshift.currentlocation.model.DayTemp"/>
</data>
<TextView
android:id="@+id/weather_status"
android:layout_width="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:text="@{HOW TO SET TEXT HERE FROM weathers list}"
android:layout_height="wrap_content" />
</layout>
Ich möchte gesetzt Symbol und Beschreibung von Wetter Klasse meiner recyclerview.
Wie erreicht man dies im Artikel Layout ????
@pskink I‘ ll gehen Sie durch ... thnx –
@tynn fragt nur Datenbindung, nicht in der Lage, auf Arraylist aus einer Klasse –
_HOW TO TEXT HIER FROM weather list_ ist keine gültige Information. Stellen Sie zumindest Code zur Verfügung, wie Sie eine Liste von 'Weather' in eine' CharSequence' konvertieren würden. Eine Hilfsmethode oder etwas vielleicht ... – tynn