最初に、私は Android と Java を初めて使用することに言及する必要があります。Serializable クラスにデータを入力する json http オブジェクトをコーディングし、それらからリストビューにデータを入力すると、すべて正常に動作しますが、Serializable クラスの 1 つの文字列を使用して、別の xml レイアウトにあるテキストビューにデータを入力しようとしています。
シリアライズ可能なクラス
public class FeedItem implements Serializable {
private static final long serialVersionUID = 1L;
private int test1;
private String title;
private String date;
private String attachmentUrl;
private String id;
private String content;
private String url;
private String tiitle = "sfsf";
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public String getAttachmentUrl() {
return attachmentUrl;
}
public void setAttachmentUrl(String attachmentUrl) {
this.attachmentUrl = attachmentUrl;
}
@Override
public String toString() {
return "[ title=" + title + ", date=" + date + "]";
}
public void save(){
FeedItem feed = new FeedItem();
Intent intent = new Intent();
Bundle extras = new Bundle();
intent.putExtra("title", feed);
そして、テキストビューに入力したいフラグメントクラス
public void UpdateList(){
TextView infoz = (TextView) getView().findViewById(R.id.infoz);
Intent intent = getActivity().getIntent();
Bundle extras = intent.getExtras();
String title = (String) getActivity().getIntent().getSerializableExtra("title");
Toast.makeText(getActivity(), title, Toast.LENGTH_LONG).show();
}
トーストは空です。