Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
101 views
in Technique[技术] by (71.8m points)

android - How to convert int to Integer

private static HashMap<Integer, Bitmap> mBitmapCache;         
mBitmapCache.put(R.drawable.bg1,object);                       

R.drawable.bg1 is an int ... but i want to convert into Integer because Hashmap takes an Integer... and when draw the multiple objects in seconds , it creates a Integer Object runtime which affects the performence of the code...

question from:https://stackoverflow.com/questions/5429273/how-to-convert-int-to-integer

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
int iInt = 10;
Integer iInteger = Integer.valueOf(iInt);

P.S. Answer edited due to comments pointing out an issue with initial suggested solution.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...