title: How can I change the language of the AlertDialog
body: <p>I'm changing the language of everything and, I did end up stuck on the part that I need to change the AlertDialog.</p>
  <p>And I think the thing that I'm getting wrong on it, is the ID stuff, I'm a bit lost on that part</p>
  <p>Same on the other languages, but different languages</p>
  <p>This is the string.xml and AlertDialog Code</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;resources&gt; &lt;string name=&quot;app_name&quot;&gt;Pntry&lt;/string&gt; 
      &lt;string name=&quot;add_item&quot;&gt;Add Item&lt;/string&gt;
      &lt;string name=&quot;enter_item_name&quot;&gt;Enter Item Name&lt;/string&gt;
      &lt;string name=&quot;enter_specifications&quot;&gt;Enter Specifications&lt;/string&gt;
      &lt;string name=&quot;select_expiry_date&quot;&gt;Select Expiry Date&lt;/string&gt;       
      &lt;string name=&quot;update_item&quot;&gt;Update Item&lt;/string&gt;
      &lt;string name=&quot;filter&quot;&gt;Filter&lt;/string&gt; 
      &lt;string name=&quot;action_filter&quot;&gt;Sort by&lt;/string&gt;
      &lt;string name=&quot;action_filter&quot;&gt;All&lt;/string&gt; 
      &lt;string name=&quot;action_filter&quot;&gt;Most outdated&lt;/string&gt;
   &lt;/resources&gt;  
  </code></pre>
  <pre class="lang-java prettyprint-override"><code>    public boolean onOptionsItemSelected(@NonNull MenuItem item) { if (item.getItemId() == R.id.action_filter) {
      final String[] listItems = new String[]{&quot;All&quot;, &quot;Most Outdated&quot;};
      
              AlertDialog.Builder alertDialog = new AlertDialog.Builder(MainActivity.this)
                      .setTitle(&quot;Sort By&quot;)
                      .setSingleChoiceItems(listItems, checkedItem[0], (dialog, which) -&gt; {
                          checkedItem[0] = which;
                          if (listItems[which].equals(&quot;All&quot;)) {
                              dialog.dismiss();
                              binding.recyclerView.setAdapter(new RecyclerViewAdapter(new DBHelper(this).getData(), this));
                              binding.recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
                                  @Override
                                  public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
                                      super.onScrolled(recyclerView, dx, dy);
                                      if (dy &gt; 0) {
                                          binding.fab.hide();
                                      } else {
                                          binding.fab.show();
                                      }
                                  }
                              });
                          } else if (listItems[which].equals(&quot;Most Outdated&quot;)){
                              dialog.dismiss();
                              binding.recyclerView.setAdapter(new RecyclerViewAdapter(new DBHelper(this).getDatewiseData(), this));
                              binding.recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
                                  @Override
                                  public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
                                      super.onScrolled(recyclerView, dx, dy);
                                      if (dy &gt; 0) {
                                          binding.fab.hide();
                                      } else {
                                          binding.fab.show();
                                      }
                                  }
                              });
                          }
                      });
      
              AlertDialog customAlertDialog = alertDialog.create();
              customAlertDialog.show();
          }
          return super.onOptionsItemSelected(item);
      }
  
  }
  </code></pre>