package com.example.fichier02;

import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;


import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;


public class vision_image extends Activity 
{
		TextView textView;
		Button btn;
    
		@Override
		protected void onCreate(Bundle savedInstanceState) 
		{
			super.onCreate(savedInstanceState);
			setContentView(R.layout.vision_image);
			textView = (TextView) findViewById(R.id.text);
			
			Intent intent = getIntent();
			String item = intent.getStringExtra("selected-item");
			textView.setPadding(10, 0, 0, 0);
			textView.setText(item);
			
      		ImageView image = (ImageView) findViewById(R.id.imageView);
        		
        	FileInputStream in;
        	BufferedInputStream buf;
		    try {
		       	    in = new FileInputStream("/sdcard/"+item);
		            buf = new BufferedInputStream(in);
		            Bitmap bMap = BitmapFactory.decodeStream(buf);
		            image.setImageBitmap(bMap);
		    } 
		        
		    catch (Exception e) 
		    {
		       	Log.e("Error reading file", e.toString());
		    }
		    
		    Button nextActivity = (Button) findViewById(R.id.btn_retour);
		    nextActivity.setOnClickListener(new View.OnClickListener() 
		    {
			     public void onClick(View view) 
			     {
				      finish();
			     }
		    });
		    
		}
    
 
}
