java - Setting LiveCard layout views and strings using the R class -
i'm trying register ids specific view attributes in r class, when update r class, android sdk rejecting values , resetting them automatically.
mlivecardview.settextviewtext(r.id.hometeamnametextview, getstring(r.id.home_team)); mlivecardview.settextviewtext(r.id.awayteamnametextview, getstring(r.id.home_team)); mlivecardview.settextviewtext(r.id.footer_text, getstring(r.id.game_quarter));
what correct way create , set id's in r class? r class livecard suppose use? lastly, there way set start_sticky integer or value?
@override public int onstartcommand(intent intent, int flags, int startid) { //timelinemanager tm = new timelinemanager(); if(mlivecard == null){ remoteviews views = new remoteviews(context.getpackagename(), r.layout.livecard_view); mlivecard.setviews(views); // // set initial remoteviews values homescore = 0; awayscore = 0; mlivecardview.settextviewtext(r.id.hometeamnametextview, getstring(r.id.home_team)); mlivecardview.settextviewtext(r.id.awayteamnametextview, getstring(r.id.home_team)); mlivecardview.settextviewtext(r.id.footer_text, getstring(r.id.game_quarter)); // set live card's action pending intent // show menu when tapped intent menuintent = new intent(this, navigateviewactivity.class); menuintent.addflags(intent.flag_activity_new_task | intent.flag_activity_clear_task); mlivecard.setaction(pendingintent.getactivity( this, 0, menuintent, 0)); // publish live card mlivecard.publish(publishmode.reveal); // queue update text runnable mhandler.post(mupdatelivecardrunnable); } return start_sticky;
r
class automatically generated android aapt
contains numerical representation
of resource ids resources in res
directory, means cannot edit r
class yourself. if want create new resource, instead of editing r
class, modify correct resource
file , android
automatically generated r
class.
see link
Comments
Post a Comment