title: Assign ressource dynamically vs. big switch case
body: <p>I have a question regarding performance and best approach for my Android code.</p>
  
  <p>What I need to do is fairly simple, I want to dynamically assign a text value to a string ressource, depending on a int parameter:</p>
  
  <p>For now I am using a big switch case</p>
  
  <pre><code>int messagesCategory;
  if(extras !=null) {
          messagesCategory = extras.getInt("category");
      }
  
  TextView titleText;
      titleText = (TextView) findViewById(R.id.headerTitle);
  
  switch (messagesCategory) {
      case 1: titleText.setText(R.string.TitleMessageList1); break;
      case 2: titleText.setText(R.string.TitleMessageList2); break;
      case 3: titleText.setText(R.string.TitleMessageList3); break;
      case 4: titleText.setText(R.string.TitleMessageList4); break;
  
      case ...: titleText.setText(R.string.TitleMessageList...); break;
  
      case n: titleText.setText(R.string.TitleMessageListn); break;
      default: titleText.setText("a default title");  break;
      }
  </code></pre>
  
  <p>Let's say I have 30 lines in this switch...
  It works but for many cases, it looks there is a better way to achieve this.
  Unfortunately it does not look possible to assign something dynamic to R.string..</p>
  
  <p>So my first question is: 1) performance wise, in this case, is it a problem to use a big switch for 30 cases or so?
  2) what should be the best approach?</p>
  
  <p>Thanks and have a good day</p>