Bitmaps (.bmp) don't show up in 'Pictures' when on SDCard

by Gavin Aiken » Sun, 08 Mar 2009 18:10:15 GMT


Sponsored Links
 Thanks clark, I wasn't aware png was lossless, I changed the format and it
all works fine!

Cheers,

Gav






--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Simple drawing sample, I seem to miss something

Hi,

I must be misunderstanding something. I am trying to draw some simple
stuff, and things appear to clear (so not to display) in moments I don't
expect it. The sample included is a simplified version of a larger
application I'm porting to Android.

What I would expect is a circle in green, with a geometry (looking like
a rather silly satelite) composed out of three red polygons, drawn in
the circle.

Can anyone tell my why this is not happening ?

Thanks,

        Danny

package info.backx.testdraw1;

import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.os.Bundle;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;

public class DrawActivity extends Activity {
        public DrawActivity thiz;
        Panel p;
        
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
       
        thiz = this;
        
        LinearLayout ll = new LinearLayout(this);
        ll.setOrientation(LinearLayout.VERTICAL);

        Button quit = new Button(this);
        quit.setOnClickListener(mDoitClick);
        quit.setText("Do it");
        ll.addView(quit);
        
        p = new Panel(this);
        ll.addView(p);
        
        setContentView(ll);
    }
    
    OnClickListener mDoitClick = new OnClickListener() {
        public void onClick(View v) {
                Log.e("Test", "DoitClick");
                
                p.erase();
                p.DrawPolygon(1, 4, new float[] {10, 95, 17, 88, 20, 95,
18, 97});
                p.DrawPolygon(1, 4, new float[] {25, 100, 32, 103, 25,
110, 22, 103});
                p.DrawPolygon(1, 4, new float[] {25, 90, 30, 95, 20,
105, 15, 100});
        }
    };
    
    
    public class Panel extends SurfaceView implements
SurfaceHolder.Callback {
        public Panel(Context context) {
                super(context);
                getHolder().addCallback(this);  
        }

        @Override
        public void surfaceChanged(SurfaceHolder arg0, int arg1, int
arg2, int arg3) {
        }

        @Override
        public void surfaceCreated(SurfaceHolder arg0) {
        }

        @Override
        public void surfaceDestroyed(SurfaceHolder arg0) {
        }

        public void DrawPolygon(int filled, int count, float[] points)
        {
                int     i;
                Path path = new Path();
                Paint paint = new Paint();
                paint.setColor(Color.RED);
                paint.setStyle(Paint.Style.FILL_AND_STROKE);
                        
                Canvas canvas = getHolder().lockCanvas();
                path.moveTo(points[0], points[1]);
                for (i=1; i<count; i++) {
                        path.lineTo(points[i*2], points[i*2+1]);
                }
                path.close();                   
                canvas.drawPath(path, paint);
                getHolder().unlockCanvasAndPost(canvas);
        }
        
        public void erase() {
                Canvas canvas = getHolder().lockCanvas();
                Paint paint = new Paint();
                paint.setColor(Color.GREEN);
                canvas.drawCircle(20, 100, 15, paint);
                getHolder().unlockCanvasAndPost(canvas);
        }
    }
}

-- 
Danny Backx ; danny.backx - at - scarlet.be ; http://danny.backx.info



-- 

2. How to load Gmail, Youtube, and Maps applications on avd.

Hello,

I have successfully installed and run an AVD targetted on Android 2.2
(Froyo).
I wanted to test the Youtube, Gmail, and Maps applications that
usually come pre-installed on Android phones.
i want to use the emulator to run these applications. Is there a way
for me to do this?

-- 

3. Android 2.2 cutting off MediaPlayer?

4. Can't create MediaPlayer from sound resource in res/raw

5. Content provider / ListView - Close the database but leave the cursor open?

6. How to reverse android.graphics.Path

7. How to click multiple buttons through sliding motion