• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Issue with setText changing the wrong text

I'm new to Android so hope this is a simple issue, I've searched using a couple of the above keywords and found nothing.
Basically I have a layout with a few textview elements a few edittext elements and a few buttons. In the java any incorrect entries by the user in the edittext elements should change a textview element which acts as user instructions to prompt the user to make corrections, the problem is it actually changes one of the button texts. Here is the code for the layout (activity_main.xml):
Code:
    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/button4"
        android:layout_marginTop="26dp"
        android:background="@color/yellow"
        android:gravity="center_horizontal"
        android:text="@string/hello_world"
        android:textColor="@color/red" />

    <Button
        android:id="@+id/button5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/textView1"
        android:layout_alignLeft="@+id/button2"
        android:layout_alignParentRight="true"
        android:onClick="onButton5Click"
        android:text="@string/stringminusfeed" />

    <Button
        android:id="@+id/button4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignRight="@+id/button3"
        android:layout_below="@+id/button3"
        android:onClick="onButton4Click"
        android:text="@string/stringminusspeed" />
And here is the code for the Java (MainActivity.java):
Code:
        TextView testView;
        testView = (TextView) findViewById(R.id.textView1);
        testView.setText("");
I know this worked as intended when I only had buttons 1-3, but adding 4 and 5 seems to have started something odd, I can't see anything wrong so am guessing this is a stupid mistake on my part. For reference it is button4 which has it's text changed by the java code. My only thought was that this was something more complicated caused by relative layout and inheritence.
Thanks in advance.
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones