0

Note that I have already gone through this solution and it does not work for me . I have a class of this structure :

public class TutorialSwipeAdapter extends PagerAdapter{
    private Context context;
    List<String>  instructions = new ArrayList<>();
    public TutorialSwipeAdapter(Context context)
    {
        this.context = context;
        addInstructions();    

    }
    //Other code
    private void addInstructions() {       
instructions.add(App.getContext().getResources().getString(R.string.Instructions_part1)); // STRING OBJECT TO BE ACCESSED 
}
}

Now, the solution works fine in general scenarios , it is rendering the default string resource as expected. But when I change the language ,it still renders the default resource (here English) whereas I want the text in Hindi . All the other string resources get converted as expected so there is no issue with the Locale class. How do I solve this issue?

UPDATE : I used context.getString(...) and changed the context ( removed null pointer exception ) and it works fine now. Thanks @Khemraj for the comments.

segfault404
  • 281
  • 1
  • 11

0 Answers0