小编Row*_*ezi的帖子

android 值将适配器传递给片段

我正在开发一个用于显示图像和文本的应用程序。单击该项目时,它会转到另一个片段。列表显示是正确的,但是当我单击该项目时,它不会碎片化。我正在使用回收器适配器来列出项目。代码如下所示。

public class MyRecyclerAdapter extends RecyclerView.Adapter < MyRecyclerAdapter.MyViewHolder > {

 String categoryId;

 private List < NewsFeeds > feedsList;
 private Context context;
 private LayoutInflater inflater;

 public MyRecyclerAdapter(Context context, List < NewsFeeds > feedsList) {

  this.context = context;
  this.feedsList = feedsList;
  inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
 }

 @Override
 public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {

  View rootView = inflater.inflate(R.layout.singleitem_recyclerview_categories, parent, false);
  return new MyViewHolder(rootView);
 }

 @Override
 public void onBindViewHolder(MyViewHolder holder, int position) {
  NewsFeeds feeds = feedsList.get(position);
  //Pass the values of feeds object …
Run Code Online (Sandbox Code Playgroud)

android android-fragments android-recyclerview

1
推荐指数
1
解决办法
2万
查看次数

使用带有POJO类的Retrofit SimpleXml-Converter解析以下XML

这是我的xml结构

<downloads>
<item>98cfa929ee93149e245aabf5e4377058</item>
<item>498b513aa646d6ef1c407cbeabf6bd20</item>
<item>13815d2c0dd53a251bb53717b9f43b64</item>
<item>7a0615eb601264bbae0ad510a31fd61d</item>
<item>3157910f72705e60d0d4ba26c3fb0e84</item>
<item>29e037200d14e21b4ccdfbfaaf1621e8</item>
<item>5f5da6505eaa203d65d1a6203dd0e742</item>
<item>98dcbf2a73016cc9e72c3cbc101de151</item>
<item>7b21d3f11bf6b12e4c4abca7004ad80d</item>
<item>116049d5a4e53240b76666c6826fc6d6</item>
<item>c7ec466398f3d8cee56147c696760076</item>
<item>66ce3335de344b32986d2b77ff992ae2</item>
</downloads>
Run Code Online (Sandbox Code Playgroud)

和细节xml

<download>
<item>
<key>9b94e79fecb1f055f279d95e800867f9</key>
<value>
A Jedi uses the Force for knowledge and defense, never for attack.
</value>
</item>
</download>
Run Code Online (Sandbox Code Playgroud)

这是我想从服务器检索并将上面的xml转换为它.

 public class DownloadPayloadCollection {
        // Class log identifier
        public final static String LOG_TAG = DownloadPayloadCollection.class.getSimpleName();
        @Root(name = "downloads")
        @ElementList(inline=true)
        private List<DownloadPayload> result;


        public DownloadPayloadCollection() {
        }

        public List<DownloadPayload> getResult() {
            Log.d(LOG_TAG, "CALLED FROM getResult() " + result.toString());
            return result;
        }
    }
Run Code Online (Sandbox Code Playgroud)

这是应该表示item元素的类.

@Root(name = …
Run Code Online (Sandbox Code Playgroud)

xml android xml-parsing retrofit2

0
推荐指数
1
解决办法
2870
查看次数