Android Canvas background

There are a lot of small images in background of my view. And position of each image depends on screen resolution. Also there are other objects that dynamically redraws after onToch ivent. It works fine without background but when i try to draw it in onDraw() i get KeyDispatchingTimedOut error. How can i compose a backgrount in a single bitmap when my app first starts, or there are other better solutions?


Bitmap background = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_4444);
Canvas canvas = new Canvas(background);
canvas.draw(yourSmallImage, posX, posY, null);
c.drawBitmap(background, 0, 0, null);

This will use 'background' as a scratchpad, then write the completed background image to the current canvas when you are done 'scratching' :-)

Need Your Help

List Count vs. Count()? Which one and why?

c# .net list

I have a list of object, i.e. List<string> myList { "Item1", "Item2", "Item3",... ... }, which method is preferred to call for counting the elements inside, and why? var count = myList.Count;...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.