Category Archives: Bitmap, drawing

Bitmap, drawing Android example codes

3,932 views

Eclipse custom skin GUI color theme

Eclipse make own color of toolbars, windows, status bar etc. https://github.com/jeeeyul/eclipse-themes/wiki/Alternative-Install

Posted in Android Examples Code, Bitmap, drawing, Eclipse | Tagged | Comments Off on Eclipse custom skin GUI color theme
11,619 views

Draw Bitmap with Alpha opacity ratio Android

Bitmap bgr = BitmapFactory.decodeResource(getResources(),R.drawable.background); Paint transparentpaint = new Paint(); transparentpaint.setAlpha(100); // 0 – 255 canvas.drawBitmap(bgr, 0, 0, transparentpaint); public void setAlpha (int a) Since: API Level 1 Helper to setColor(), that only assigns the color’s alpha value, leaving its r,g,b … Continue reading

Posted in Android Examples Code, Bitmap, drawing | Tagged , | Comments Off on Draw Bitmap with Alpha opacity ratio Android
2,905 views

Delete Canvas – Fill Canvas Android example

Fill the entire canvas with the specified color. @Override public void onDraw(Canvas canvas) { canvas.drawColor(Color.GREEN); }

Posted in Android Examples Code, Bitmap, drawing | Tagged , , | Comments Off on Delete Canvas – Fill Canvas Android example
8,695 views

Get Screen Size Pixels per Inch Android example

The exact physical pixels per inch of the screen Get size of pixel Get DPI Get count of pixels per inch float mXDpi; float mYDpi; DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); mXDpi = metrics.xdpi; // The exact physical pixels per … Continue reading

Posted in Android Examples Code, Bitmap, drawing | Tagged , | Comments Off on Get Screen Size Pixels per Inch Android example
7,838 views

Get the color of a specific pixel Java Android example

ImputStream is = this.getResources().openRawResource(R.drawable.colors); Bitmap mBitmap2 = BitmapFactory.decodeStream(is);   int w = mBitmap2.getWidth(); int h = mBitmap2.getHeight(); // int x , y have to be smaller as w , h int _color = mBitmap2.getPixel(x, y);

Posted in Android Examples Code, Bitmap, drawing | Tagged , , , | Comments Off on Get the color of a specific pixel Java Android example
3,109 views

Android SDK Samples as a Photo Gallery

Photo Gallery of Android SDK Samples. For better understanding of what the source knows there is a gallery of images. After clicking on the preview displays the actual size and Titlebar You can read the path to the source file … Continue reading

Posted in Android Examples Code, Bitmap, drawing | Tagged , | Comments Off on Android SDK Samples as a Photo Gallery
13,611 views

How to clear or hide an ImageView in Android

// solution 1 ImageView imageView = (ImageView)findViewById(R.id.myimage); imageView.setImageDrawable(null); // or imageView.setImageResource(0);   // solution 2 hide ImageView imageView.setVisibility(View.INVISIBLE);   // solution 3 resize ImageView 0, 0 hImageViewSemafor.setLayoutParams(new LinearLayout.LayoutParams(0,0));

Posted in Android Examples Code, Bitmap, drawing | Tagged , | Comments Off on How to clear or hide an ImageView in Android
12,521 views

Immutable bitmap passed to Canvas constructor – Android error

Try this source code: Bitmap myBitmap = BitmapFactory.decodeResource(getResources(),R.drawable.my_image) .copy(Bitmap.Config.ARGB_8888, true); Canvas c = new Canvas(myBitmap); // etc. ……. Issue: Immutable bitmap passed to Canvas constructor Solution: Bitmap myBitmap = BitmapFactory.decodeResource(getResources(),R.drawable.my_image) .copy(Bitmap.Config.ARGB_8888, true);

Posted in Android Examples Code, Bitmap, drawing, Bugs, warnings, errors | Tagged | Comments Off on Immutable bitmap passed to Canvas constructor – Android error
24,458 views

Convert Drawable to Bitmap to Drawable

Context context = getApplicationContext(); Drawable drawable = context.getResources().getDrawable(R.drawable.my_image); // convert drawable to bitmap Bitmap bitmap = ((BitmapDrawable)drawable).getBitmap(); // convert bitmap to drawable Drawable d = new BitmapDrawable(bitmap); Android example source code.

Posted in Android Examples Code, Bitmap, drawing | Tagged , , | Comments Off on Convert Drawable to Bitmap to Drawable
24,030 views

Hue saturation, color, colored filtering Bitmap Image Android example

/* Copyright (C) 2011 The Android Open Source Project http://www.apache.org/licenses/LICENSE-2.0 */ public class MainActivity extends Activity { private ImageView imageView; private Button button1; Drawable bitmapOrg; private final int[] mColors = {Color.BLUE, Color.GREEN, Color.RED, Color.LTGRAY, Color.MAGENTA, Color.CYAN, Color.YELLOW, Color.WHITE};   @Override … Continue reading

Posted in Android Examples Code, Bitmap, drawing | Tagged , , | Comments Off on Hue saturation, color, colored filtering Bitmap Image Android example