Both activities are in the same package
Second activity uses second layout file
setContentView(R.layout.main2);
Errors on this line
From Android TextView Documentation:
setText(int resid)
Sets the text to be displayed using a string resource identifier.
It is due to typecast error. You have to try this- TextView.setText(Integer.toString(variable_name));
Here toString is used to convert integer to string for showing text.
I was using Picasso library to load image from the network. The urls are in a ArrayList I wasn't using arraylist.get() to get the position of the url in the ArrayList.
face with the same error
finally i found its not a error due to your xml layout
somewhere in your code set TextView.setText(int)
try TextView.setText( Integer.toString(int));
I recently had this problem, when i was trying to integrate SocialAuth libray with my Android application with Android Studio. What was my problem was, some of my resources like facebook icon, were in the mipamp folder. I moved it to drawables folder and the issue got fixed.
Just for the protocol, You could also use:
TextView.setText("" + intVar)
instead of TextView.setText(intVar)