title: how to pass data from activity to fragment..?
body: <p>Hello everyone i need help in passing data from activity to fragment.</p>
  
  <p>im using the this way but getting error of null pointer .</p>
  
  <p><strong>In main Activity</strong> </p>
  
  <pre><code> @Override
      public void onClick(View v) {
          switch (v.getId()) {
              case R.id.leftfeedback:
                  handleChanges();
                  break;
          }
      }
  
     private void handleChanges() {
  
                  FeedBackFragment feedBackFragment =new FeedBackFragment();
                  if (feedBackFragment != null) {
                     feedBackFragment.fragmentCommunication(ExtraData);
                  } else {
                      Log.i(TAG, "Fragment 2 is not initialized");
                  }
      }
  </code></pre>
  
  <p><strong>in fragment side</strong> 
  all given data is coming i checked with log before to set on </p>
  
  <pre><code>   public class FeedBackFragment extends Fragment{
  
      private static final String TAG ="FeedBackFragment" ;
  
      View view;
  
      TextView feedbackEditText;
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  
          view = inflater.inflate(R.layout.feedback_fragemnt, container, false);
  
          feedbackEditText = (TextView) view.findViewById(R.id.feedbackEditText);
  
  
          return view;
      }
  
      public void fragmentCommunication(String feedBackData) {
  
      log.i(TAG,feedBackData);
          try {
  
              JSONObject jsonObject = new JSONObject(feedBackData);
  
              String message = jsonObject.getString("message");
              if(message.trim()!=null){
  
              feedbackEditText.setText(message);
  
               }
             } catch (JSONException e) {
              e.printStackTrace();
          }
  
      }
  
  }
  </code></pre>