title: setContentView of multiple activities from a another class
body: <p>I am creating a android application which needs to be able to setcontentview on  multiple android activities layouts in few methods in a another global class. Therefore when I call the method from a new activity onCreate then the buttons and textviews are assigned by findviewbyId by method in previously defined class. Example code is shown below.</p>
  
  <pre><code>   public void executeWorkItem() {
              setContentView(R.layout.activity_message);
              Button button = (Button) findViewById(R.id.btnSendSMS);
              button.setOnClickListener(new Button.OnClickListener() {
                  public void onClick(View v) {
                      EditText textPhone = (EditText) findViewById(R.id.phoneNum);
                      EditText textSms = (EditText) findViewById(R.id.smsContent);
                      final String phoneNumber = textPhone.getText().toString();
                      final String message = textSms.getText().toString();
                      Map&lt;String, Object&gt; results = new HashMap&lt;String, Object&gt;();
                      results.put("phoneNmbr", "" + phoneNumber);
                      results.put("message", "" + message);
                  }
              });
          }
  </code></pre>
  
  <p>Therefore when I call this method from activity like shown below then the methhod should be executed without getting null error.</p>
  
  <pre><code>  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      app = (MyApplication)getApplication();
  
       // Call a custom application method
      app.executeWorkItem();
  } 
  </code></pre>
  
  <p>Therefore should I create a application class for this or do I have to create a Object which extends Activity and call that object method in there ?
  Note : that I should be able to create different methods which can do similar things. </p>