java - String value not showing in output.setText -
im trying show day name along date in app , text defined "text" shows fine , integer values show fine, not show text variable, have:
calendar = calendar.getinstance(); textview output3 = (textview) findviewbyid(r.id.output3); int dayno = now.get(calendar.day_of_week); string dayname = new string();// tried string dayname = ""; same results if (dayno == 1) dayname = "sun"; if (dayno == 1) dayname = "mon"; if (dayno == 1) dayname = "tue"; if (dayno == 1) dayname = "wed"; if (dayno == 1) dayname = "thu"; if (dayno == 1) dayname = "fri"; if (dayno == 1) dayname = "sat";
also tried this:
if (dayno == 1) {dayname = "sun";} if (dayno == 1) {dayname = "mon";} if (dayno == 1) {dayname = "tue";} if (dayno == 1) {dayname = "wed";} if (dayno == 1) {dayname = "thu";} if (dayno == 1) {dayname = "fri";} if (dayno == 1) {dayname = "sat";} output3.settext(hour + ":" + minute + ":" + second + " week " + weekno + ", " + dayname + ", " + yearno);
this result getting (middle text field has error)
i can't figure out wrong here, appreciated
please change code follows:
calendar = calendar.getinstance(); textview output3 = (textview) findviewbyid(r.id.output3); int dayno = now.get(calendar.day_of_week); string dayname = new string();// tried string dayname = ""; same results if (dayno == 1) dayname = "sun"; if (dayno == 2) dayname = "mon"; if (dayno == 3) dayname = "tue"; if (dayno == 4) dayname = "wed"; if (dayno == 5) dayname = "thu"; if (dayno == 6) dayname = "fri"; if (dayno == 7) dayname = "sat";
Comments
Post a Comment