title: Android Helper classes
body: <p>I have a couple of methods in my android application that I would like to reuse across multiple Activities, as it's a Java helper class I'm not extending from anything. I have two problems, the first is how to pass the context into the java class and the second is how to use methods that extend from activity in the helper class, below is my helper class:</p>
  
  <p><strong>Java Class</strong></p>
  
  <pre><code>public class ScreenHelper {
      Context context;
      public ScreenHelper(Context ctx) {
          this.context = ctx;
      }
  
      public int getStatusBarHeight(layout layout) {
          Rect r = new Rect();
          Window w = (Window) getWindow();
          w.getDecorView().getWindowVisibleDisplayFrame(r);
          return r.top;
      }
  
      public int getScreenHeight() {
          DisplayMetrics metrics = new DisplayMetrics();
          getWindowManager().getDefaultDisplay().getMetrics(metrics);
          int ScreenHeight = metrics.heightPixels;
          return ScreenHeight;
      }
  
      public int getTitleBarHeight() {
          RelativeLayout relaLayout = (RelativeLayout) findViewById(R.id.title_bar);
          int titleHeight = relaLayout.getHeight();
  
          Log.d("Title Height","Title Height:" + titleHeight);
          return titleHeight;
      }
  }
  </code></pre>
  
  <p>Any help would be much appreciated.</p>