Index: /issm/trunk-jpl/src/android/ISSM/src/com/example/issm/ISSM.java
===================================================================
--- /issm/trunk-jpl/src/android/ISSM/src/com/example/issm/ISSM.java	(revision 13995)
+++ /issm/trunk-jpl/src/android/ISSM/src/com/example/issm/ISSM.java	(revision 13996)
@@ -1,6 +1,13 @@
 package com.example.issm;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.DoubleBuffer;
 
 import android.os.Bundle;
 import android.app.Activity;
+import android.content.res.AssetManager;
 import android.text.TextUtils;
 import android.view.Menu;
@@ -12,10 +19,24 @@
 
 
-public class ISSM extends Activity implements OnClickListener {
+public class ISSM extends Activity implements OnClickListener 
+{
 	private EditText input;
 	private TextView output;
+	private DoubleBuffer buff;
+	private IssmJni issmNative;
+	private String mapName;
+	private String textinFile;
+	private String actualinput;
     @Override
+  //------------------------------------------------------------------------------------------------    
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
+        Bundle map = getIntent().getExtras();
+        {
+        	if(map!= null)
+        	{
+        		mapName = map.getString("map");
+        	}
+        }
         setContentView(R.layout.activity_issm);
         this.input  = (EditText) super.findViewById(R.id.input);
@@ -23,17 +44,70 @@
         Button button = (Button) super.findViewById(R.id.button1);
         button.setOnClickListener(this);
+        this.readFile(mapName);
         
+        //load up the ISSM library and create double buffer in java
+        //which later on will be pass for native allocation.
+        issmNative = new IssmJni();
+        buff = ByteBuffer.allocateDirect(15*8).order(ByteOrder.nativeOrder()).asDoubleBuffer();
+        this.createModel("Model");
     }
-    
-	public void onClick(View view) 
+//------------------------------------------------------------------------------------------------    
+    public void createModel(String Model)
+    {
+    	issmNative.initialize();
+    }
+//------------------------------------------------------------------------------------------------
+    public void readFile(String mapName)
+    {
+    	AssetManager am = getAssets();
+    	String mapNameFile = "Map/"+mapName+".txt";
+        try {
+			InputStream is = am.open(mapNameFile);
+			int size = is.available();
+			byte[]buffer = new byte[size];
+			is.read(buffer);
+			is.close();
+			
+			textinFile = new String(buffer);
+			
+			//testing on actual file
+			InputStream is1 = am.open("Map/test102.petsc");
+			int size1 = is1.available();
+			byte[]buffer1 = new byte[size1];
+			is1.read(buffer1);
+			System.out.println(buffer1);
+			is1.close();
+			actualinput = new String(buffer1);
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+    }
+//------------------------------------------------------------------------------------------------
+    public void fillBuffer()
+    {
+    	issmNative.processBuffer(buff);
+    }
+ //------------------------------------------------------------------------------------------------   
+    public void onClick(View view) 
 	{
-		// TODO Auto-generated method stub
+		//factorial method
 		String input = this.input.getText().toString();
 		if(TextUtils.isEmpty(input))
 		{
 			return;
-		}
-		long result = IssmJni.facIterative(Long.parseLong(input));
-		this.output.setText("Result = " + result + "\n");
+		}		
+		long resultfromFac = issmNative.fac(Long.parseLong(input));
+		//example of how to fill buffer Native
+		this.fillBuffer();
+		
+		//print result from fac and the first two slot of filled buffer.
+		this.output.setText("Result = " + resultfromFac + "\n" 
+										+ "First two slot from buffer:\n" 
+										+ buff.get(1) + "          " + buff.get(2) 
+										+ "\nmap name = " + mapName
+										+ "\nTxtFile    " + textinFile
+										+"\nactualFile   " + actualinput);
+
 	}
 }
Index: /issm/trunk-jpl/src/android/ISSM/src/com/example/issm/IssmJni.java
===================================================================
--- /issm/trunk-jpl/src/android/ISSM/src/com/example/issm/IssmJni.java	(revision 13995)
+++ /issm/trunk-jpl/src/android/ISSM/src/com/example/issm/IssmJni.java	(revision 13996)
@@ -1,13 +1,13 @@
 package com.example.issm;
+import java.nio.DoubleBuffer;
 
-public class IssmJni
+class IssmJni
 {
-	public static native long fac(long n);
-	static {
+	public native long fac(long n);
+	public native void processBuffer(DoubleBuffer buff);
+	public native void initialize();
+	static 
+	{
         System.loadLibrary("IssmJni");
     }
-	public static long facIterative(long n)
-	{
-		return fac(n);
-	}
 }
Index: /issm/trunk-jpl/src/android/ISSM/src/com/example/issm/MapSelection.java
===================================================================
--- /issm/trunk-jpl/src/android/ISSM/src/com/example/issm/MapSelection.java	(revision 13996)
+++ /issm/trunk-jpl/src/android/ISSM/src/com/example/issm/MapSelection.java	(revision 13996)
@@ -0,0 +1,49 @@
+package com.example.issm;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.view.Menu;
+import android.view.View;
+import android.widget.Button;
+import android.content.Intent;
+
+public class MapSelection extends Activity
+{
+	private String map;
+	ISSM issm = new ISSM();
+	public void onCreate(Bundle icicle)
+	{
+		super.onCreate(icicle);
+		setContentView(R.layout.activity_mapselection);
+		
+		//this button represents greenland and pass signal to issm
+		Button gl = (Button) findViewById(R.id.button1);		
+		gl.setOnClickListener(new View.OnClickListener() 
+		{
+			
+			public void onClick(View v) 
+			{
+				// TODO Auto-generated method stub
+				Intent i = new Intent(MapSelection.this, ISSM.class);
+				i.putExtra("map", "greenland");
+		        startActivity(i);
+			}
+		});
+		
+		//this button represents artantice and pass signal to issm
+		Button art = (Button) findViewById(R.id.button2);
+		art.setOnClickListener(new View.OnClickListener() 
+		{
+			
+			public void onClick(View v) 
+			{
+				// TODO Auto-generated method stub
+				Intent i = new Intent(MapSelection.this, ISSM.class);
+				i.putExtra("map", "antarctica");
+		        startActivity(i);
+			}
+		});
+	}
+}
+ 
