Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How can use Bitmap in android

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 155
    Comment on it

     

    In the below exampl e I have added a image with the help of Bitmap. Bitmap is eventually created and displayed on the screen. By using simply bitmap a pixels of rectangle, each pixel can be set to a given color  but exactly what color depends on the type of the pixel. You can see below example code it clearly describe you How can use Bitmap in android.

    public class MainActivity extends AppCompatActivity {
        
            @Override
            public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(new myView(this));
            }
    
            private class myView extends View{
    
                public myView(Context context) {
                    super(context);
                }
    
                @Override
                protected void onDraw(Canvas canvas) {
                    Bitmap myBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.one);
                    canvas.drawBitmap(myBitmap, 0, 0, null);
                    Bitmap b = Bitmap.createBitmap(500, 500,  Bitmap.Config.ARGB_8888);
                    b.eraseColor(Color.RED);
    
    
                }
            }
        }
    
    

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: