java - how displaying money amount in blackjack android game development -


i'm new android development , wondering how should store money value player current has? should store string in string.xml or should make int in method? how should make deck of cards. should use array? told shouldnt store string , dont know how can display when launch app if not stored string. appreciated!

  <textview         android:background ="@android:color/white"         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:text="@string/cash"         android:padding="5dip"         />   im storing in textview 

not sure on deck of cards, store money float. not int. displaying simple since java can make float string adding float empty string

str = "" + flt; complicated? how?

protected boolean store_cash(){    sharedpreferences settings = getsharedpreferences("general", 0);         sharedpreferences.editor editor = settings.edit();         editor.putfloat("cash", mcash);         return editor.commit(); } protected void load_cash(){  sharedpreferences settings = getsharedpreferences("general", 0);  mcash = settings.getfloat("cash", (float) 0.0); } 

with it's matter of setting title of textview

protected void display_cash(){     textview cash = (textview ) findviewbyid(r.id.cash);     cash.settext( "$" + mcash);  //formatting may required..  google friend } 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -