/*
 * This is a simple Android mobile client
 * This application read any string messege typed on the text field and 
 * send it to the server when the Send button is pressed
 * Author by Lak J Comspace
 */

package com.MOS.fastfood;


import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;




public class MainActivity extends Activity {
	
	//******** Defining Objects
	RestaurantData restaurantData = new RestaurantData();

	//******** Defining String
	String URL = "http://jce-fastfood-project.appspot.com/?togo=restfunctions";
	String tempResult ="";

	//******** Defining Buttons
	Button list,get;
	
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		HttpGetConnection getRequest = new HttpGetConnection();
		getRequest.execute(URL);
		
		list = (Button) findViewById(R.id.save);
		get = (Button) findViewById(R.id.get);
		final TextView tv = (TextView) findViewById(R.id.showData);
		
		//GET button for fetching all restaurants list
		get.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				
				
				//Toast.makeText(getApplicationContext(), HttpGetConnection.tempResult, Toast.LENGTH_LONG).show();
				//System.out.println(HttpGetConnection.tempResult);
				RestaurantData restaurantData = new RestaurantData();
				System.out.println(RestaurantData.rate.size() + "-" + RestaurantData.name.size());
				for(int i =0; i < RestaurantData.rate.size(); i++)
				{
					tv.append(restaurantData.rate.get(i) + "--\n");
				}
				//tv.append(RestaurantData.lng.get(RestaurantData.lng.size()));			
			}
		});
		
		//List button to move to the LIST ACTIVITY
		list.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(getApplicationContext(), ListActivity.class);
				startActivity(intent);
				/*try {
					String query = "My name is bond, james bond";

					String urlQ = "http://jce-fastfood-project.appspot.com/" + URLEncoder.encode(query, "UTF-8");
					Toast.makeText(getApplicationContext(), urlQ, Toast.LENGTH_LONG).show();
				} catch (UnsupportedEncodingException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}*/
				//new RequestTask().execute("http://jce-fastfood-project.appspot.com/?lng=15");
			}
		});
	}
	
}

@@ -1,239 +1,145 @@
-/*%0A * This is a simple Android mobile client%0A * This application read any string messege typed on the text field and %0A * send it to the server when the Send button is pressed%0A * Author by Lak J Comspace%0A */%0A%0Apackage com.MOS.fastfood;%0A%0A
+%0A%0Apackage com.MOS.fastfood;%0A%0A%0Aimport com.facebook.appevents.AppEventsLogger;%0A%0Aimport android.app.Activity;%0Aimport android.app.ProgressDialog;
 %0Aimp
@@ -146,36 +146,39 @@
 ort android.
-app.Activity
+content.Context
 ;%0Aimport and
@@ -385,18 +385,16 @@
 oast;%0A%0A%0A
-%0A%0A
 public c
@@ -430,17 +430,16 @@
 ivity %7B%0A
-%09
 %0A%09//****
@@ -514,16 +514,40 @@
 tData();
+%0A%09ProgressDialog dialog;
 %0A%0A%09//***
@@ -674,58 +674,8 @@
 %22;%0A%0A
-%09//******** Defining Buttons%0A%09Button list,get;%0A%09%0A%09
 %0A%09@O
@@ -819,1062 +819,227 @@
 ;%0A%09%09
-%0A%09%09HttpGetConnection getRequest = new HttpGetConnection();%0A%09%09getRequest.execute(URL);%0A%09%09%0A%09%09list = (Button) findViewById(R.id.save);%0A%09%09get = (Button) findViewById(R.id.get);%0A%09%09final TextView tv = (TextView) findViewById(R.id.showData);%0A%09%09%0A%09%09//GET button for fetching all restaurants list%0A%09%09get.setOnClickListener(new OnClickListener() %7B%0A%09%09%09%0A%09%09%09@Override%0A%09%09%09public void onClick(View v) %7B%0A%09%09%09%09%0A%09%09%09%09%0A%09%09%09%09//Toast.makeText(getApplicationContext(), HttpGetConnection.tempResult, Toast.LENGTH_LONG).show(
+//Send HTTP GET REQUEST to the server to get all the restaurants%0A%09%09HttpGetConnection getRequest = new HttpGetConnection(MainActivity.this
 );%0A%09%09
-%09
-%09//System.out.println(HttpGetConnection.tempResult);%0A%09%09%09%09RestaurantData restaurantData = new RestaurantData();%0A%09%09%09%09System.out.println(RestaurantData.rate.size() + %22-%22 + RestaurantData.name.size());%0A%09%09%09%09for(int i =0; i %3C RestaurantData.rate.size(); i++)%0A%09%09%09%09%7B%0A%09%09%09%09%09tv.append(restaurantData.rate.get(i) + %22--%5Cn%22);%0A%09%09%09%09%7D%0A%09%09%09%09//tv.append(RestaurantData.lng.get(RestaurantData.lng.size()));%09%09%09%0A%09%09%09%7D%0A%09%09%7D);%0A%09%09%0A%09%09//List button to move to the LIST ACTIVITY%0A%09%09list.setOnClickListener(new OnClickListener() %7B%0A%09%09%09%0A%09%09%09@Override%0A%09%09%09public void onClick(View v) %7B%0A%09%09%09%09
+HttpGetConnection.start_activity = true;%0A%09%09getRequest.executeGet(URL);%0A%0A%0A%09%09//
 Inte
@@ -1109,18 +1109,18 @@
 ass);%0A%09%09
-%09%09
+//
 startAct
@@ -1138,468 +1138,11 @@
 t);%0A
-%09%09%09%09/*try %7B%0A%09%09%09%09%09String query = %22My name is bond, james bond%22;%0A%0A%09%09%09%09%09String urlQ = %22http://jce-fastfood-project.appspot.com/%22 + URLEncoder.encode(query, %22UTF-8%22);%0A%09%09%09%09%09Toast.makeText(getApplicationContext(), urlQ, Toast.LENGTH_LONG).show();%0A%09%09%09%09%7D catch (UnsupportedEncodingException e) %7B%0A%09%09%09%09%09// TODO Auto-generated catch block%0A%09%09%09%09%09e.printStackTrace();%0A%09%09%09%09%7D*/%0A%09%09%09%09//new RequestTask().execute(%22http://jce-fastfood-project.appspot.com/?lng=15%22);%0A%09%09%09%7D%0A%09%09%7D);%0A
 %09%7D%0A
-%09
+%0A
 %0A%7D%0A

Update MainActivity.java