• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

How do I simply set the color of a single pixel?

I want to be able to draw something, and the first step is to be able to set the color of a pixel? Once I can do that, I can set the color of all pixels as needed. First I need a control that supports drawing though. I've tried the ImageView and SurfaceView controls, and coded everything to work to set the color of a pixel. But it doesn't work. It seems that setting a pixel's color doesn't actually update the screen. So the pixel remains the same color on the screen. I need to know how to do this properly. Is there a way to force the screen to refresh and display the changed pixel color?

One of the most important things in an app, is to be able to draw to the screen, especially if you want to display custom graphics or even write an image-editor app. It seems like such a basic concept to read or write the value of a pixel, but in Android it seems like an almost impossible task.
 
Direct pixel control is a pretty old approach - I used to do that with my Apple II in '78.

I'm not even sure how it would work, since just about every device could have a different resolution.

Am I understanding correctly: You're trying to create a drawing app?
 
Back
Top Bottom