the files created by my aplication are deleted after turn off USB storage

by Caius 'kaio' Chance » Wed, 03 Feb 2010 01:20:23 GMT


Sponsored Links
 


Afaik, as Android is a derivation of Linux, you might need to unmount
the USB storage properly before physically unplug that. Unlike to
Windows where you will see a progress bar to show the status, writing
data in *nix is that you will see the files appear on the destination in
advance to files written completely.

Just 2c based on *nix, please kindly point out if I am wrong.

-- 
Rgds  Caius 'kaio' Chance
  Fedora Project Contributor  http://fedoraproject.org/wiki/User :kaio
  kaio at fedoraproject.org, kaio on irc.freenode.net, GPG: 17BEFCFA

--



Other Threads

1. HowTo make ListView Larger so more than one item visible at a time ?

Please look issue:
http://code.google.com/p/android/issues/detail?id=6552
Here also present workaround

-- 

2. SurfaceView and View Flipper

Hi, do any try to flip between the views where 1 of view is
SurfaceView.

What I tried is:
1. Made a simple view flipper.
2. Added touch listner.

a) with 2 image views it works fine

b) change the first view for SurfaceView as a result surface image
never moved from screen.

Can anybody suggest ?

Thanks in advanced.

--- sources:
CustomSurfaceView.java

package com.viewflipper;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.view.SurfaceHolder;
import android.view.SurfaceView;

public class CustomSurfaceView extends SurfaceView implements
SurfaceHolder.Callback {
    private Bitmap bitmap;
    private SurfaceHolder surfaceHolder;

    public CustomSurfaceView(Context context, AttributeSet attrs, int
defStyle) {
        super(context, attrs, defStyle);
        initHolder(context);
    }

    public CustomSurfaceView(Context context, AttributeSet attrs) {
        super(context, attrs);
        initHolder(context);
    }

    public CustomSurfaceView(Context context) {
        super(context);

        initHolder(context);

    }

    private void initHolder(Context context) {
        bitmap = BitmapFactory.decodeResource(context.getResources(),
R.drawable.surface);
        surfaceHolder = getHolder();
        surfaceHolder.addCallback(this);
    }

    @Override
    public void surfaceChanged(SurfaceHolder holder, int format, int
width, int height) {
    }

    @Override
    public void surfaceCreated(SurfaceHolder holder) {
        Canvas c = null;
        try {
            c = surfaceHolder.lockCanvas();
            c.drawBitmap(bitmap, 0, 0, null);
        } finally {
            surfaceHolder.unlockCanvasAndPost(c);
        }
    }

    @Override
    public void surfaceDestroyed(SurfaceHolder holder) {
    }

    @Override
    public void draw(Canvas canvas) {
    }

    @Override
    protected void onDraw(Canvas canvas) {
    }
}


ViewFlipper.java

package com.viewflipper;

import android.content.Context;
import android.util.AttributeSet;
import android.view.animation.AnimationUtils;
import android.widget.ViewAnimator;

public class ViewFlipper extends ViewAnimator {
    private boolean isFirst = true;
    private Context context;

    public ViewFlipper(Context context, AttributeSet attrs) {
        super(context, attrs);
        this.context = context;
    }

    public ViewFlipper(Context context) {
        super(context);
        this.context = context;
    }

    /**
     * Change view.
     */
    public void changeView() {
        if (isFirst) {
            isFirst = false;
            setInAnimation(AnimationUtils.makeInAnimation(context,
false));
            setOutAnimation(AnimationUtils.makeOutAnimation(context,
false));
            showNext();
        } else {
            isFirst = true;
            setInAnimation(AnimationUtils.makeInAnimation(context,
true));
            setOutAnimation(AnimationUtils.makeOutAnimation(context,
true));
            showPrevious();
        }
    }
}

FlipperActivity.java

package com.viewflipper;

import android.app.Activity;
import android.os.Bundle;
import android.view.MotionEvent;

public class FlipperActivity extends Activity {
    private ViewFlipper flipper;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        flipper = (ViewFlipper) findViewById(R.id.flipper);
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        if (MotionEvent.ACTION_UP == event.getAction()) {
            flipper.changeView();
        }
        return false;
    }
}

-- 

3. Emulator takes too much time to show up - any solution?

4. How to get directions / duration from current location to xyz location...

5. How to debug unexpected exceptions (source not found)

6. "System.out.println(...)" statements within the onCreate

7. comparing a string array with a string