title: How to send ResourceId from Fragment to another class
body: <p>I am implementing custom keyboard in my fragment. I want to send ResourceId of EditText located in my fragment's UI to custom keyboard class. I am getting NullPointerException on receiving ResourceId in custom keyboard class which means Resourceid is not sent. </p>
  
  <p>The code I've implemented is:</p>
  
  <pre><code>@Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
          Bundle savedInstanceState) {
  
      rootView = inflater.inflate(R.layout.fragment_barcode_detail,
              container, false);
      inflater = (LayoutInflater) mActivity
              .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  editText_barcode = (EditText) rootView
              .findViewById(R.id.editText_barcode);
  mCustomKeyboard = new CustomKeyboard(mActivity, R.id.keyboardview,R.xml.hexkbd);
      System.out.println("====inac====" + R.id.editText_barcode);
      mCustomKeyboard.registerEditText(mActivity, R.id.editText_barcode);
  
      return rootView;
  }
  </code></pre>
  
  <p>Custom keyboard Class is:</p>
  
  <pre><code>class CustomKeyboard {
  
  
  private KeyboardView mKeyboardView;
  /** A link to the activity that hosts the {@link #mKeyboardView}. */
  private Activity mHostActivity;
  private  EditText edittext;
  
  
  public CustomKeyboard(Activity host, int viewid, int layoutid) {
      mHostActivity= host;
      mKeyboardView= (KeyboardView)mHostActivity.findViewById(viewid); //   
  Getting Resourceid successfully 
      mKeyboardView.setKeyboard(new Keyboard(mHostActivity, layoutid));
      mKeyboardView.setPreviewEnabled(false); 
      mKeyboardView.setOnKeyboardActionListener(mOnKeyboardActionListener);
  
   }
  
  public void registerEditText( int resid) {
      // Find the EditText 'resid'
      System.out.println("======ed"+resid);
       edittext= (EditText)mHostActivity.findViewById(resid);//   
  Not Getting Resourceid 
  }
  </code></pre>