-3

Actually this idea came to my mind and i want to fill the image on android screen with almost all the possible colors there could be. So i somehow want to create an image view (if possible) and randomly set color code for each pixel or tiny cubes and fill the image view with this manner. So could someone tell me if it is possible then how could i achieve it. I searched a lot for something useful but couldn't find it. Any help will be appreciated.

Thanks.

Ashu
  • 2,970
  • 1
  • 19
  • 31

1 Answers1

0

Create a new Bitmap.

Make an array of the colors you want that has the size equal to the size of the bitmap

Use createBitmap(int[] colors, int width, int height, Bitmap.Config config) and pass the above mentioned array as the first parameter

Read more about createBitmap here

Edit: Since you want the image to cover the whole screen, the size should be equivalent to the screen size in pixels. You can learn how to get screen size here

Community
  • 1
  • 1
Mehmet K
  • 2,805
  • 1
  • 23
  • 35
  • How would i know how many values i should pass. And how would i know when the size of the bitmap ends. Will it handle all that automatically...? – Ashu Feb 08 '17 at 13:22
  • Did you read the explanation of the method? I've linked it to my answer – Mehmet K Feb 08 '17 at 13:24
  • Ohh sorry. I am new to SO so i am not familiar with the color scheme. – Ashu Feb 08 '17 at 13:25
  • It isn't opening. Chrome gives error ERR_NAME_NOT_RESOLVED plz check the if the link address is correct. – Ashu Feb 08 '17 at 13:26
  • I fixed the link @Ashu – Mehmet K Feb 08 '17 at 13:28
  • Thanx for the help @howdoidothis.. Damn it was such an easy thing. I am embarrassed now. I can't handle more downvotes so i guess i might delete this que. But for your help i will upvote your answer on some other que from your profile. Thanx again. – Ashu Feb 08 '17 at 14:03
  • Even if you didn't search the right things. Show the community you tried at least some thing. Add what you think might work/ what you have tried into your question. And while trying to do that, you might actually find the solution yourself – Mehmet K Feb 08 '17 at 14:05
  • umm... if you say so. – Ashu Feb 08 '17 at 15:52