java - Convert from Double to String in Android -
i trying convert value double string in android activity.i can work first example here below (working in sense of no squigly error eclipse). curious why second example not working.
first example
balance = (textview) findviewbyid(r.id.textviewcardbalance); intent intent = getintent(); if (intent.getextras() != null) { balance.settext(string.valueof((long)intent.getdoubleextra("balance", 0.00))); }
second example below not working (error: "cannot cast double long"
balance = (textview) findviewbyid(r.id.textviewcardbalance); double cardbalance; intent intent = getintent(); if (intent.getextras() != null) { cardbalance = intent.getdoubleextra("balance", 0.00); balance.settext(string.valueof((long)cardbalance); }
would know how can second example work need log value retrieved intent before passing textview.
thanks
why can't this?
balance.settext(cardbalance + "");
Comments
Post a Comment