title: An array of views by ids
body: <p>I have the interface where I have to use buttons not list not anything but buttons. I was wondering if there's a away to group the buttons by ids instead of looping in the switch(which is very long) because of my many buttons.
  Normally If its a listview adapter I would do something like this if am in an adapteview</p>
  
  <pre><code> String[] clickitems = getResources().getStringArray(R.array.array) ;
       String toclasses = clickitems[position] ;
               try {
                  Class classes = Class.forName(getPackageName()+"."toclasses);
                   Intent intent = new Intent(Main.this, classes);
                   intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP) ;
                   startActivity(intent) ;
              } catch (ClassNotFoundException e) { 
                  e.printStackTrace();
              }
          }
  </code></pre>
  
  <p>Now i would like to use the same method for getting the clicked button using v.getId() as the array to use instead of the position for that case. Instead of</p>
  
  <pre><code>            switch(v.getId()){
               case R.id.xxx:
                 break;
               }
  </code></pre>
  
  <p>Any ideas on how to approach it that way</p>