android - Progress Bar not loading? -
i have small game i'm working on , i'm trying have progress bar xp bar. have set thing won't move
private static final int progress = 0x1; private progressbar mprogress; private handler mhandler = new handler(); private int mprogressstatus; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.play_screen); mprogress = (progressbar) findviewbyid(r.id.xpbar); mprogress.setmax(integer.parseint(textviewxpnextlevel.gettext().tostring())); new thread(new runnable() { public void run() { int xp = integer.parseint(textviewxpvalue.gettext().tostring()); int xpnext = integer.parseint(textviewxpnextlevel.gettext().tostring()); while (mprogressstatus < xpnext) { mprogressstatus = xp; mhandler.post(new runnable() { public void run() { mprogress.setprogress(mprogressstatus); } }); } } }).start();
i'm pretty sure set correctly. doesn't load @ all? had working before not doesn't work. ideas?
it while loop (mprogressstatus < xpnext) going infinite loop. how mprogressstatus or xpnext value going change after while loop starts ? not clear in code.
Comments
Post a Comment