Android Studio Error: String literal in setText cannot be translated -
this first app , i'm having trouble.
when run app crashes , don't know how fix error.
public class mainactivity extends appcompatactivity {\ textview outputbottom = (textview)findviewbyid(r.id.output); } public void play_the_big_lie(view view) { the_big_lie.start(); outputbottom.settext("obamacare, big lie"); }
string literal in settext cannot translated
this not error , can safely ignore (unless need translation in app).
it notification android studio should using string resource file instead of hard-coded string.
if had guess @ source of issue since did not post logcat, this.
you can't use findviewbyid
before setcontentview
because there no view "find".
please try following code
public class mainactivity extends appcompatactivity { private textview outputbottom; protected void oncreate(bundle b) { super.oncreate(b); setcontentview(r.layout.activity_main); outputbottom = (textview)findviewbyid(r.id.output); }
Comments
Post a Comment