package com.test;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
public class Test01Activity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// タイトルの非表示
requestWindowFeature(Window.FEATURE_NO_TITLE);
//タスクバーの非表示
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
ImageView v = (ImageView) findViewById(R.id.imageView1);
File srcFile = new File("/mnt/sdcard/Pictures/a0002_006064.jpg");
try {
InputStream is = new FileInputStream(srcFile);
Bitmap bm = BitmapFactory.decodeStream(is);
v.setImageBitmap(bm);
} catch (FileNotFoundException e) {
// TODO 自動生成された catch ブロック
e.printStackTrace();
}
}
}
2011年11月23日水曜日
Pictures フォルダの画像をImageView に表示
関連記事
登録:
コメントの投稿 (Atom)

0 件のコメント:
コメントを投稿