Answers ( 2 )

  1. 2017-01-03 10:01

    Make sure that you have to set adapter again after selecting another locale file. If you are using RecyclerView, then set LayoutManager to your recycler view like this:

    RecyclerView yourRecyclerView= (RecyclerView) findViewById(;
    LinearLayoutManager layoutManager = new LinearLayoutManager(MainActivity.this, LinearLayoutManager.VERTICAL, false);
    RecyclerViewAdapter yourAdapter = new RecyclerViewAdapter (MainActivity.this, yourArrayList);
  2. 2017-01-03 10:01

    You can get the current language of the device using the Locale object and then compare it to the constants of the Locale object. For example:

    Log.d(TAG, "onCreate: "+Locale.ENGLISH);
    Log.d(TAG, "onCreate: "+Locale.getDefault().getDisplayLanguage());
    Log.d(TAG, "onCreate: "+Locale.getDefault().getDisplayCountry());
    Log.d(TAG, "onCreate: "+Locale.getDefault().getCountry());
    Log.d(TAG, "onCreate: "+Locale.getDefault().getLanguage());


    onCreate: en
    onCreate: English
    onCreate: United Kingdom
    onCreate: GB
    onCreate: en

    Don't forget to call adapter.notifyDataSetChanged() after your data collection has changed to make sure the adapter applies the changes.

◀ Go back