Category Archives: Bitmap, drawing

Bitmap, drawing Android example codes

6,520 views

SurfaceView implements Runnable Android Code

package cz.okhelp.surfview;   import android.os.Bundle; import android.app.Activity; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.view.Menu; import android.view.MotionEvent; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.View; import android.view.View.OnTouchListener;   public class MainActivity extends Activity implements OnTouchListener { OurView v; Bitmap ball, … Continue reading

Posted in Android Examples Code, Bitmap, drawing | Tagged , | Comments Off on SurfaceView implements Runnable Android Code
5,404 views

Get Bitmap Size Get Free Memory Exception Android

Bitmap size calculation: bmpHeight * bmpWidth For example: Resolution of image 1024×860 = 880 640 pixels If every pixel get 4 byte of memory: 880 640×4= 3 522 560 (3.5MB) Get bitmap size without allocation of memory: BitmapFactory.Options options = … Continue reading

Posted in Android Examples Code, Bitmap, drawing | Tagged , | Comments Off on Get Bitmap Size Get Free Memory Exception Android
6,744 views

Delete Bitmap Android Example

If some memory leak – problem try release of memory used of a big Bitmap what already not to need; Bitmpap bmp; // not null bmp.recycle(); bmp = null;   final boolean bmpIsRecycled = bmp.isRecycled() // Returns true if this … Continue reading

Posted in Android Examples Code, Bitmap, drawing | Tagged | Comments Off on Delete Bitmap Android Example
2,064 views

How get bitmap dimension without loading Android example

Bitmap Width, Height without memory allocation: BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeResource(getResources(), R.id.myimage, options); // now opts.outWidth and opts.outHeight are the dimension of the // bitmap, even though Bitmap is null int imageHeight = options.outHeight; int imageWidth … Continue reading

Posted in Android Examples Code, Bitmap, drawing | Tagged , | Comments Off on How get bitmap dimension without loading Android example
2,354 views

How to create icon for Android apps

First cteate big icon 512×512 px formtat .PGN in graphics editor as Photoshop, Gimp, Piant.NET and save image. If you create new project via Eclipse and choice your 512×512 image for ic_launcher. Eclipse will make all icons from this image … Continue reading

Posted in Android Examples Code, Bitmap, drawing | Tagged , | Comments Off on How to create icon for Android apps
3,721 views

Drawable Bitmap get width height Android

Drawable dr = getResources().getDrawable(R.drawable.algebra); int h = dr.getIntrinsicHeight(); int w = dr.getIntrinsicWidth();   Bitmap ball = BitmapFactory.decodeResource(getResources(), R.drawable.algebra); int _nWidth = ball.getWidth(); int _nHeight = ball.getHeight();

Posted in Android Examples Code, Bitmap, drawing | Tagged , | Comments Off on Drawable Bitmap get width height Android
9,516 views

How to Scroll large image in ImageView Android Example

main.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:gravity="top" android:layout_width="fill_parent" android:layout_height="fill_parent" >   <ScrollView android:id="@+id/scrollView1" android:layout_width="fill_parent" android:layout_height="wrap_content" >   <HorizontalScrollView android:id="@+id/horizontalScrollView1" android:layout_width="match_parent" android:layout_height="wrap_content" >     <LinearLayout android:gravity="top" android:layout_width="fill_parent" android:layout_height="wrap_content" >   <ImageView android:id="@+id/imageViewObrazekGeometrie" android:layout_width="360dp" android:layout_height="777dp" android:src="@drawable/geometrie_vzorecky" />   </LinearLayout> </HorizontalScrollView> </ScrollView>   </LinearLayout>

Posted in Android Examples Code, Bitmap, drawing | Tagged , | Comments Off on How to Scroll large image in ImageView Android Example
8,443 views

Resize ImageView Image in View Android Example

How to resize an image in ImageView Android source code. Resize imageview layout and image will resize too: public void resizeImageView(int width, int height) { final ImageView picture1 = (ImageView)findViewById(R.id.imageView1); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(width, height); picture1.setLayoutParams(layoutParams); }

Posted in Android Examples Code, Bitmap, drawing | Tagged , , | Comments Off on Resize ImageView Image in View Android Example
9,729 views

Cross Button in EditText Android

Cross Button in EditText Android for deleting clearing text in EditText Example source code: Example allow delete text in EditText by cross button, or do Button click performance. main.xml type your package name and class Put into drawable folder cross … Continue reading

Posted in Android Examples Code, Bitmap, drawing | Tagged , | Comments Off on Cross Button in EditText Android
2,951 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