我有一个应用程序的源代码,它显示在后端服务器中上传的值列表,但问题是它以相反的顺序显示值(首先列出上传的旧内容)我希望它正好相反(按日期) . public class SelectQuizActivity extends AppCompatActivity {private static final String TAG = SelectQuizActivity.class.getSimpleName();private int categoryId;private String catName;private String catImage;private ImageView categoryImage;private TextView categoryName;private RecyclerView quizRecyclerView;@Overrideprotected void onCreate(Bundle savedInstanceState) { requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); super.onCreate(savedInstanceState); setContentView(R.layout.activity_select_quiz); categoryId = getIntent().getExtras().getInt(Constants.CATEGORY); catName = getIntent().getExtras().getString(Constants.CATEGORY_NAME); catImage = getIntent().getExtras().getString(Constants.CATEGORY_IMAGE); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); if(getSupportActionBar() != null){ getSupportActionBar().setElevation(0); } setTitle(""); categoryImage = (ImageView)findViewById(R.id.quiz_category_image); categoryName = (TextView)findViewById(R.id.quiz_category_name); quizRecyclerView = (RecyclerView)findViewById(R.id.quiz_category); quizRecyclerView.setLayoutManager(new GridLayoutManager(SelectQuizActivity.this, 3)); quizRecyclerView.setHasFixedSize(true); if(Helper.isNetworkAvailable(this)){ allSubcategoryInCategory(catName); }else{ DisplayMessage.displayErrorMessage(this, "No network available"); }}上面的代码从类别适配器获取输入并将其显示为回收站视图
3 回答
小怪兽爱吃肉
TA贡献1852条经验 获得超1个赞
首先调用这个
Collections.reverse(arrayToListObject(response));
然后
CategoryAdapter mAdapter = new CategoryAdapter(SelectQuizActivity.this, arrayToListObject(response)); quizRecyclerView.setAdapter(mAdapter);
添加回答
举报
0/150
提交
取消