i have added onClick in my mainactivity for my textview and i had no errors but when i run the app it crashes saying app has stopped working even though i have no errors in my c
Change to
public void runNextTask(View v){ // method signature is worng
Also if textView is in activity_main.xml. There is no need to inflate the layout
setContentView(R.layout.activity_main); // is enough
And initialize textView in onCreate
TextView modelTextview = (TextView)findViewById(R.id.state2);
If you want to have click listener progrmatically remove
android:onClick="runNextTask"