Can not find a View with findViewById()

You have to call setContentView(...) BEFORE you attempt to find any of the UI components. You’re trying to find the TextView before you’ve called it.

Change your code to this…

super.onCreate(savedInstanceState);
setContentView(R.layout.other_activity);
TextView textView = (TextView)findViewById(R.id.txt02);

Leave a Comment