title: Change Fragment's TextViews's text from Activity
body: <p>I want to change an textView's text via an Activity, but when I change by this code:</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
  
  private TextView txtSave;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      txtSave = (TextView)findViewById(R.id.txt_save);;
  }
  
  public void onClick(View v) {
      TextView txtSave;
      txtSave = (TextView)findViewById(R.id.txt_save);
      txtSave.setText("something");
  }
  </code></pre>
  
  <p>}</p>
  
  <p>and I got this error:</p>
  
  <pre><code>05-14 13:47:46.835 21949-21949/stv.wordspower E/AndroidRuntime: FATAL EXCEPTION: main
                                                              Process: stv.wordspower, PID: 21949
                                                              java.lang.IllegalStateException: Could not execute method for android:onClick
                                                                  at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:293)
                                                                  at android.view.View.performClick(View.java:4756)
                                                                  at android.view.View$PerformClick.run(View.java:19749)
                                                                  at android.os.Handler.handleCallback(Handler.java:739)
                                                                  at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                  at android.os.Looper.loop(Looper.java:135)
                                                                  at android.app.ActivityThread.main(ActivityThread.java:5221)
                                                                  at java.lang.reflect.Method.invoke(Native Method)
                                                                  at java.lang.reflect.Method.invoke(Method.java:372)
  </code></pre>
  
  <p>Can somebody add me help how can I change dynamically?
  Fragment code:</p>
  
  <pre><code>public class ProgressFragment extends Fragment {
  
  private View rootView;
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
      rootView = inflater.inflate(R.layout.fragment_progress, container, false);
      return rootView;
  }
  
  public static ProgressFragment newInstance() {
      Bundle args = new Bundle();
      ProgressFragment fragment = new ProgressFragment();
      fragment.setArguments(args);
      return fragment;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>The textView is on the ProgressFragment. The ProgressFragment is on the MainActivity's FrameLayout.
  I just want to modify the TextView's values but I can't. I have tried these <a href="https://stackoverflow.com/questions/16295101/how-to-change-fragments-textviews-text-from-activity">solutions</a>, but one did not work.</p>
  
  <p>other informations:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:id="@+id/activity_main"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:paddingBottom="@dimen/activity_vertical_margin"
  android:paddingLeft="@dimen/activity_horizontal_margin"
  android:paddingRight="@dimen/activity_horizontal_margin"
  android:paddingTop="@dimen/activity_vertical_margin"
  tools:context="stv.wordspower.MainActivity"&gt;
  
  &lt;TextView
      android:text="@string/txtView_welcome"
      android:textSize="30sp"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignParentTop="true"
      android:layout_alignParentLeft="true"
      android:layout_alignParentStart="true"
      android:id="@+id/textView"
      android:layout_alignParentRight="true"
      android:layout_alignParentEnd="true"
      android:textAlignment="center" /&gt;
  
  &lt;Button
      android:text="@string/btn_exit"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:id="@+id/btn_exit"
      android:layout_alignParentBottom="true"
      android:layout_centerHorizontal="true" /&gt;
  
  &lt;Button
      android:id="@+id/btn_settings"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:text="@string/btn_settings"
      android:layout_above="@+id/btn_contact"
      android:layout_alignParentLeft="true"
      android:layout_alignParentStart="true" /&gt;
  
  &lt;Button
      android:id="@+id/btn_contact"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:text="@string/btn_contact"
      android:layout_above="@+id/btn_exit"
      android:layout_alignParentLeft="true"
      android:layout_alignParentStart="true" /&gt;
  
  &lt;Button
      android:id="@+id/btn_progress"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignParentEnd="true"
      android:layout_alignParentLeft="true"
      android:layout_alignParentRight="true"
      android:layout_alignParentStart="true"
      android:layout_below="@+id/textView"
      android:text="@string/btn_progress" /&gt;
  
  &lt;FrameLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:layout_alignParentLeft="true"
      android:layout_alignParentStart="true"
      android:layout_below="@+id/btn_progress"
      android:layout_above="@+id/btn_settings"
      android:layout_alignParentRight="true"
      android:layout_alignParentEnd="true"
      android:id="@+id/mainActivityFragmentLayout"&gt;
  &lt;/FrameLayout&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  tools:context="stv.wordspower.ProgressFragment"
  android:orientation="vertical"&gt;
  
  &lt;!-- TODO: Update blank fragment layout --&gt;
  
  &lt;TextView
      android:id="@+id/txt_progresses"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:text="@string/txt_progresses"
      android:textAlignment="center"
      android:textColor="@android:color/background_dark"
      android:textSize="30dp"
      android:textStyle="bold" /&gt;
  
  &lt;TextView
      android:id="@+id/txt_save"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:text="@string/txt_empty"
      android:textAlignment="center"
      android:textSize="30dp"
      android:onClick="onClick"
      android:clickable="true"/&gt;
  </code></pre>
  
  <p></p>