Here is my code. well,basically i just modify a little (very little

) ImageSwitcher1.java from APIDemo, but it became not working
Using java Syntax Highlighting
import java.net.URISyntaxException;
import android.app.Activity;
import android.net.ContentURI;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.view.animation.AnimationUtils;
import android.widget.ImageSwitcher;
import android.widget.ImageView;
import android.widget.ViewSwitcher;
public class Gambar extends Activity implements ViewSwitcher.ViewFactory {
private ImageSwitcher mSwitcher;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.image_switcher_1);
mSwitcher = (ImageSwitcher) findViewById(R.id.switcher);
mSwitcher.setFactory(this);
mSwitcher.setInAnimation(AnimationUtils.loadAnimation(this,
android.R.anim.fade_in));
mSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this,
android.R.anim.fade_out));
showImage();
}
private void showImage() {
// TODO Auto-generated method stub
try {
mSwitcher.setImageURI(new ContentURI("file:///data/data/com.gambar/files/Tudung01.jpg"));
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public View makeView() {
// TODO Auto-generated method stub
ImageView i = new ImageView(this);
i.setBackgroundColor(0xFF000000);
i.setScaleType(ImageView.ScaleType.FIT_CENTER);
i.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT));
return i;
}
}
Parsed in 0.036 seconds, using
GeSHi 1.0.8.4
please help...
