 <p>This code working fine for me</p> <p><pre><code> import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView;</p> <p>public class MainActivity extends Activity {</p> <pre><code>Button btnClick = null; TextView txtView = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btnClick = (Button) findViewById(R.id.btnClick); txtView = (TextView) findViewById(R.id.txtView); btnClick.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { txtView.setText("MP 204"); } }); } } </code></pre> <p></pre></code> the layout file</p> <pre><code>&lt;RelativeLayout 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=".MainActivity" &gt; &lt;Button android:id="@+id/btnClick" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:text="ClickMe" /&gt; &lt;TextView android:id="@+id/txtView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/btnClick" android:layout_alignParentRight="true" android:layout_below="@+id/btnClick" android:text="@string/hello_world" /&gt; &lt;/RelativeLayout&gt; </code></pre>