there useful class in android (at least me). bundle class allows put kind of pair key value. value can different established classes of objects.
for example:
bundle mbundle = new bundle(); mbundle.putint("number one", 1); mbundle.putboolean("true", true); there similar class in java?
not know of, it's easy reproduce hashmap:
public class bundle extends hashmap<string,object>{ public void putstring(string key, string str){ put(key, str); } public string getstring(string key){ object o = get(key); if(o!=null && o instanceof string) return (string) o; return null; } public void putinteger(string key, int anint){ put(key, new integer(anint)); } public integer getinteger(string key){ object o = get(key); if(o!=null && o instanceof integer) return (integer) o; return null; } ... }
Comments
Post a Comment