Android – how do I use locale and configuration to select different asset files as my language changes?

I want to change the JSON file from the assets folder according to the language changes in the application, and I want to feel the data in recyclerview

But my adapter is not suitable for this change

resolvent:

Make sure that you must set the adapter again after selecting another locale file. If you are using recyclerview, set layoutmanager as your Recycle Bin view, as shown below:

RecyclerView yourRecyclerView= (RecyclerView) findViewById(R.id.yourRecyclerView);
linearlayoutmanager layoutManager = new linearlayoutmanager(MainActivity.this, linearlayoutmanager.VERTICAL, false);
rc_qList.setHasFixedSize(true);
rc_qList.setLayoutManager(layoutManager);

RecyclerViewAdapter yourAdapter = new RecyclerViewAdapter (MainActivity.this, yourArrayList);
rc_qList.setAdapter(yourAdapter);

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>