package com.example.webview01;

import java.io.File;

import android.app.Activity;
import android.os.Bundle;
import android.os.Environment;
import android.view.Menu;
import android.view.MenuItem;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.TextView;

public class MainActivity extends Activity {

	
	private WebView picView;
	private TextView titre;
	 String imagePath = "/nadatest.png";

	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		
	//	picView.getSettings().setBuiltInZoomControls(true);
	//	picView.getSettings().setUseWideViewPort(true);
		
		//picView.loadUrl("file:///"+imagePath);
		
	//	picView.loadUrl("file://res/drawable/im1.png");

		
		//picView.loadUrl("file:///mnt/sdcard/nadatest.jpg");
		
		
		   
		          
		

		titre = (TextView) findViewById(R.id.textview);
		picView = (WebView) findViewById(R.id.pic_view);
		
		//picView.getSettings().setJavaScriptEnabled(true);
		//picView.loadUrl("http://www.google.com");
		
//		WebSettings webSettings = picView.getSettings();
//	    webSettings.setBuiltInZoomControls(true);
//	    picView.loadUrl("http://analog-design.net/ALARME/img01.jpg");
		
		          
/*		
		
		        String fullUrl = "file:/"
		          + Environment.getExternalStorageDirectory().getAbsolutePath().toString()
		          + imagePath;
		        */
		        String path = "file://mnt/sdcard/tmp.jpg";
		        
			    picView.loadUrl(path);
				
//				WebSettings webSettings = picView.getSettings();
//			    webSettings.setBuiltInZoomControls(true);

			    picView.getSettings().setBuiltInZoomControls(true);
			    picView.getSettings().setUseWideViewPort(true);
			    
			    titre.setText(path);

		        
		        File f = new File(path);
		        if(f.exists() )
		        { 
		        	String probleme = "0";

		        }
		        else
		        {
		        	String probleme = "1";
		        }
		        
		       // picView.loadUrl(fullUrl);
//		        webView.getSettings().setBuiltInZoomControls(true);
//		        webView.getSettings().setUseWideViewPort(true);
//		        webView.getSettings().setLoadWithOverviewMode(true);
		  
		
		
		String toto = "6546";
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		// Handle action bar item clicks here. The action bar will
		// automatically handle clicks on the Home/Up button, so long
		// as you specify a parent activity in AndroidManifest.xml.
		int id = item.getItemId();
		if (id == R.id.action_settings) {
			return true;
		}
		return super.onOptionsItemSelected(item);
	}
}
