title: how can i change textview text of fragment from activity
body: <p>i have dynamically added fragment(which is inflated from secfrag.xml) in main activity. there are two buttons in my main activity. one for adding fragment and the other is for changing text of my fragment. i have successfully added fragment to my activity but i can not change the textview text of my fragment. how can i do that. </p>
  
  <pre><code>public class MyActivity extends ActionBarActivity {
     Button addFragment;
     Button changeFragText;
  
     @Override
     protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_my);
      addFragment = (Button) findViewById(R.id.mybtn);
      changeFragText = (Button) findViewById(R.id.mybtn2);
  
  
  
      addFragment.setOnClickListener(new OnClickListener() {
  
          @Override
          public void onClick(View view) {
                  Secfragjava secfragjava = new Secfragjava();
                  getFragmentManager().beginTransaction().add(R.id.mainholder, secfragjava).commit();
  
              }
  
  
          });
  
      changeFragText.setOnClickListener(new OnClickListener() {
  
          @Override
          public void onClick(View view) {
              //how can i have the fragment and change its textview
              TextView frv=(TextView) getFragmentManager().findFragmentById(R.id.container).getView().findViewById(R.id.mysecText);
              frv.setText("raton");
          }
      });
  
  }
  </code></pre>