Thursday, 7 June 2012

LoginActivity.java


package com.qualcomm.QCARSamples.ImageTargets;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;

import oauth.signpost.http.HttpResponse;

import org.apache.http.HttpEntity;
import org.apache.http.HttpEntityEnclosingRequest;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.ResponseHandler;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.BasicResponseHandler;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.Toast;

public class LoginActivity extends Activity {
String URL = MainURL.URL + "login";
List<NameValuePair> pairs;
HttpClient client;
HttpPost post;
HttpResponse response;
EditText email, password;
String result;
JSONArray jArray;
String responseBody;
String[] items;
ProgressDialog dialog;
String[] u_id;
CheckBox remember;
SharedPreferences abc;
SharedPreferences.Editor editor;
public static final String PREFS = "Preferences";
String email_pref = null, password_pref = null;

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login);
email = (EditText) findViewById(R.id.email);
password = (EditText) findViewById(R.id.password);
remember = (CheckBox) findViewById(R.id.check_remember);
password.setText(null);
this.abc = getSharedPreferences(PREFS, 0);

email_pref = abc.getString("email", null);
password_pref = abc.getString("password", null);
email.setText(email_pref);
password.setText(password_pref);


//abc = this.getSharedPreferences("myPrefs", MODE_WORLD_WRITEABLE);
int height = getWindowManager().getDefaultDisplay().getHeight();
// ImageView logo = (ImageView) findViewById(R.id.logo);
// logo.setLayoutParams(new
// RelativeLayout.LayoutParams(getWindowManager()
// .getDefaultDisplay().getWidth(), height / 3));
Button signin = (Button) this.findViewById(R.id.signin);
Button signup = (Button) this.findViewById(R.id.signup);
signup.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent(LoginActivity.this,
RegistrationActivity.class);
startActivity(intent);

}
});
signin.setOnClickListener(new OnClickListener() {
public void onClick(View v) {

if ((email.getText().length() == 0)
|| (password.getText().length() == 0)) {
Toast.makeText(getApplicationContext(),
"Email and Password is not Correct", 4000).show();
} else {
doLogin();

}
}
});

}

public void doLogin() {
dialog = ProgressDialog.show(this, "", "Loading Data ...Please Wait",
true);
double TIMEOUT_MILLISEC = 1234567890;

HttpParams httpParams = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(httpParams,
(int) TIMEOUT_MILLISEC);
HttpConnectionParams.setSoTimeout(httpParams, (int) TIMEOUT_MILLISEC);
//
HttpParams p = new BasicHttpParams();
// p.setParameter("name", pvo.getName());
p.setParameter("email", email.getText().toString());
p.setParameter("password", password.getText().toString());

p.setParameter("key", "c89a7662dae613ea3d20d334339b6dff");
p.setParameter("Login", "Login");

// Instantiate an HttpClient
HttpClient httpclient = new DefaultHttpClient(p);

HttpPost httppost = new HttpPost(URL);

List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(4);
nameValuePairs.add(new BasicNameValuePair("email", email.getText()
.toString()));
nameValuePairs.add(new BasicNameValuePair("password", password
.getText().toString()));
nameValuePairs.add(new BasicNameValuePair("key",
"c89a7662dae613ea3d20d334339b6dff"));
nameValuePairs.add(new BasicNameValuePair("Login", "Login"));

try {
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
} catch (UnsupportedEncodingException e) { // TODO Auto-generated catch
;
}

ResponseHandler<String> responseHandler = new BasicResponseHandler();
try {
responseBody = httpclient.execute(httppost, responseHandler);
Log.e("aaaaaaaaaaaaaaaaaaaaaaaaa+++", responseBody.toString());
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
// int start = responseBody.indexOf("{");
// int end = responseBody.length();
// String result = responseBody.substring(start, end);
// // Toast.makeText(getApplicationContext(), result, 9000).show();
// String result1 = "[" + result.toString().trim() + "]";
//
int start = responseBody.indexOf("status");
int end = responseBody.length();
String result = responseBody.substring(start, end);
// Toast.makeText(getApplicationContext(), result, 9000).show();
String result1 = "[{" + '"' + result.toString().trim() + "]";

try {
jArray = new JSONArray(result1.toString());
} catch (JSONException e) {
Log.e("log_tag", "Error parsing data " + e.toString());
}

try {
items = new String[jArray.length()];
u_id = new String[1];

for (int i = 0; i < jArray.length(); i++) {

items[i] = jArray.getJSONObject(i).getString("status")
.toString();
Log.e("item", items[i]);
}
// Toast.makeText(getApplicationContext(), items[0],
// 4000).show();
} catch (JSONException e) {
Log.e("log_tag", "Error parsing data " + e.toString());
}
if (items[0].equalsIgnoreCase("OK")) {
if ((dialog.isShowing()))
dialog.dismiss();
try {
u_id[0] = jArray.getJSONObject(0).getString("u_id");
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Constants.u_id=u_id[0];
Intent intent = new Intent(LoginActivity.this,
fbtwitterActivity.class);
intent.putExtra("u_id", u_id[0]);
startActivity(intent);

} else {
if ((dialog.isShowing()))
dialog.dismiss();
Toast.makeText(getApplicationContext(),
"enter proper username and password", 4000).show();
}
} catch (NullPointerException e) {
if ((dialog.isShowing()))
dialog.dismiss();
Toast.makeText(getApplicationContext(), "try after some time", 4000)
.show();
}
if (remember.isChecked() == true) {
this.abc = getSharedPreferences(PREFS, 0);
editor = abc.edit();
editor.putString("email", email.getText().toString());
editor.putString("password", password.getText()
.toString());
editor.commit();
}
}
}

Tuesday, 5 June 2012

navigate.xml


<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2007 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at
 
          http://www.apache.org/licenses/LICENSE-2.0
 
     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.










-->

<!--
     Demonstrates use of the com.google.android.maps.MapView.
     See corresponding Java code com.example.android.apis.view.MapViewDemo.java.










-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/main"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/bg"
    android:orientation="vertical" >

    <LinearLayout
        android:id="@+id/toplayout"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/top_bar"
        android:orientation="horizontal" >

        <Button
            android:id="@+id/back"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/back_btn" />

        <TextView
            android:id="@+id/urhere"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_weight="1"
            android:gravity="center"
            android:text="You Are Here"
            android:textColor="#663300" />

        <Button
            android:id="@+id/home"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/home_btn" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/middlelayout"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <TextView
            android:id="@+id/from"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="From"
            android:textColor="#663300" />

        <EditText
            android:id="@+id/place"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:background="@drawable/urhereet"
            android:text="   " />

        <Button
            android:id="@+id/exchange"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/urherearrow" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/gpslayout"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <TextView
            android:id="@+id/place_tv"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="To    "
            android:textColor="#663300" />

        <EditText
            android:id="@+id/place_et"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:background="@drawable/urhereet"
            android:text="Surat" />

        <Button
            android:id="@+id/gps"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/urherego" />
    </LinearLayout>

    <com.google.android.maps.MapView
        android:id="@+id/mapview"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:apiKey="0VV2WOyqkXNdui8250kVmtf5sYajGT1_CZ2jJqQ"
        android:clickable="true"
        android:enabled="true" />

    <LinearLayout
        android:id="@+id/zoom"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true" />

</LinearLayout>

mainfirstscreen.xml


<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/mainlayout"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/home_bg" >

    <RelativeLayout
        android:id="@+id/headingText"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_marginTop="10dp"
        android:background="@drawable/top_bar"
        android:orientation="horizontal" >

        <Button
            android:id="@+id/settings"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_marginLeft="10dp"
            android:background="@drawable/settings" />

        <ImageView
            android:id="@+id/image"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_centerInParent="true"
            android:layout_centerVertical="true"
            android:layout_gravity="center"
            android:background="@drawable/lg_home"
            android:gravity="center" />
    </RelativeLayout>

    <com.devsmart.android.ui.HorizontalListView
        android:id="@+id/listview"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/headingText" />

    <RelativeLayout
        android:id="@+id/buttonlayout"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/imagelayout"
        android:clipChildren="false"
        android:orientation="horizontal" >

        <RelativeLayout
            android:id="@+id/leftbuttonlayout"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:orientation="vertical" >

            <Button
                android:id="@+id/gujarat"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:layout_marginBottom="8dp"
                android:background="@drawable/gujarat"
                android:gravity="center" />

            <Button
                android:id="@+id/ff"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/gujarat"
                android:layout_marginTop="8dp"
                android:background="@drawable/fairs_festivals"
                android:gravity="center" />
        </RelativeLayout>

        <RelativeLayout
            android:id="@+id/rightbuttonlayout"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_marginLeft="16dp"
            android:layout_toRightOf="@id/leftbuttonlayout"
            android:orientation="vertical" >

            <Button
                android:id="@+id/AR"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:layout_marginBottom="8dp"
                android:background="@drawable/augmented_reality"
                android:gravity="center" />

            <Button
                android:id="@+id/touristspot"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@id/AR"
                android:layout_marginTop="8dp"
                android:background="@drawable/tourists"
                android:gravity="center" />
        </RelativeLayout>
    </RelativeLayout>

    <RelativeLayout
        android:id="@+id/slidinglayout"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/imagelayout"
        android:layout_toLeftOf="@id/buttonlayout" >

        <Button
            android:id="@+id/open"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_centerInParent="true"
            android:layout_toLeftOf="@id/buttonlayout"
            android:background="@drawable/slider_arrow"
            android:gravity="center" />

        <RelativeLayout
            android:id="@+id/slidingpanel"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:background="@drawable/sidepanel_bg"
            android:orientation="vertical"
            android:visibility="invisible" >

            <Button
                android:id="@+id/button1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:layout_gravity="center"
                android:layout_marginTop="9dp"
                android:background="@drawable/wishlist_icon"
                android:gravity="top"
                android:paddingLeft="5dp" />

            <RelativeLayout
                android:id="@+id/buttonsublayout"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/button1"
                android:orientation="horizontal" >

                <Button
                    android:id="@+id/button2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerHorizontal="true"
                    android:layout_gravity="center"
                    android:background="@drawable/friends_icon"
                    android:gravity="center"
                    android:paddingLeft="5dp" />

                <Button
                    android:id="@+id/button22"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_toRightOf="@id/button2"
                    android:background="@drawable/closearrow" />
            </RelativeLayout>

            <Button
                android:id="@+id/button3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:layout_gravity="center"
                android:background="@drawable/triplist_icon"
                android:gravity="bottom"
                android:paddingLeft="13dp" />
        </RelativeLayout>
    </RelativeLayout>

</RelativeLayout>

settings.xml


<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/mainlayout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/bg" >

    <LinearLayout
        android:id="@+id/headingText"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_marginTop="10dp"
        android:background="@drawable/top_bar"
        android:orientation="horizontal" >

        <Button
            android:id="@+id/back"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/back_btn" />

        <TextView
            android:id="@+id/text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_weight="1"
            android:gravity="center"
            android:text="Settings"
            android:textColor="#663300"
            android:textSize="19sp" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/emaillayout"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/headingText"
        android:layout_centerHorizontal="true"
        android:orientation="horizontal"
        android:paddingTop="25dp" >

        <TextView
            android:id="@+id/e_mail"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingLeft="15dp"
            android:text="E-Mail           "
            android:textColor="#663300"
            android:textSize="16sp" >
        </TextView>

        <EditText
            android:id="@+id/email"
            android:layout_width="150dp"
            android:layout_height="wrap_content"
            android:paddingLeft="15dp"
            android:textSize="10sp" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/homecitylayout"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/emaillayout"
        android:layout_centerHorizontal="true"
        android:orientation="horizontal"
        android:paddingTop="5dp" >

        <TextView
            android:id="@+id/homecity_tv"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingLeft="15dp"
            android:text="Home City*  "
            android:textColor="#663300"
            android:textSize="16sp" >
        </TextView>

        <EditText
            android:id="@+id/homecity"
            android:layout_width="150dp"
            android:layout_height="wrap_content"
            android:paddingLeft="15dp"
            android:textSize="10sp" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/facebooklayout"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/homecitylayout"
        android:layout_centerHorizontal="true"
        android:orientation="horizontal"
        android:paddingTop="5dp" >

        <TextView
            android:id="@+id/facebook_tv"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingLeft="15dp"
            android:text="Facebook      "
            android:textColor="#663300"
            android:textSize="16sp" >
        </TextView>

        <RadioGroup
            android:id="@+id/radiogroup_fb"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >

            <RadioButton
                android:id="@+id/yes_fb"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:checked="true"
                android:text="Yes"
                android:textColor="#663300" >
            </RadioButton>

            <RadioButton
                android:id="@+id/no_fb"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:text="NO"
                android:textColor="#663300" >
            </RadioButton>
        </RadioGroup>
    </LinearLayout>

    <LinearLayout
        android:id="@+id/twitterlayout"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/facebooklayout"
        android:layout_centerHorizontal="true"
        android:orientation="horizontal"
        android:paddingTop="5dp" >

        <TextView
            android:id="@+id/twitter_tv"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingLeft="15dp"
            android:text="Twitter           "
            android:textColor="#663300"
            android:textSize="16sp" >
        </TextView>

        <RadioGroup
            android:id="@+id/radiogroup_twitter"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >

            <RadioButton
                android:id="@+id/yes_twitter"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Yes"
                android:textColor="#663300" >
            </RadioButton>

            <RadioButton
                android:id="@+id/no_twitter"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:checked="true"
                android:text="NO"
                android:textColor="#663300" >
            </RadioButton>
        </RadioGroup>
    </LinearLayout>

    <LinearLayout
        android:id="@+id/buttonlayout"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/twitterlayout"
        android:layout_centerHorizontal="true"
        android:gravity="center_horizontal"
        android:orientation="horizontal"
        android:paddingTop="5dp" >

        <Button
            android:id="@+id/save"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/save"
            android:paddingLeft="15dp" >
        </Button>

        <Button
            android:id="@+id/changeuser"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="20dp"
            android:background="@drawable/change_user"
            android:paddingLeft="15dp" />
    </LinearLayout>

</RelativeLayout>

navigate_all.xml


<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2007 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at
 
          http://www.apache.org/licenses/LICENSE-2.0
 
     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.





















-->

<!--
     Demonstrates use of the com.google.android.maps.MapView.
     See corresponding Java code com.example.android.apis.view.MapViewDemo.java.





















-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/main"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/bg"
    android:orientation="vertical" >

    <LinearLayout
        android:id="@+id/toplayout"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/top_bar"
        android:orientation="horizontal" >

        <Button
            android:id="@+id/small"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/small"
            android:visibility="invisible" />

        <TextView
            android:id="@+id/gps"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_weight="1"
            android:gravity="center"
            android:text="Navigate"
            android:textColor="#663300" />

        <Button
            android:id="@+id/home"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/home_btn" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/fromlayout"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <TextView
            android:id="@+id/from_tv"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="From"
            android:textColor="#663300" />

        <EditText
            android:id="@+id/from_et"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:background="@drawable/urhereet"
            android:inputType="text" />

        <Button
            android:id="@+id/notrequired1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/urherearrow"
            android:gravity="right"
            android:visibility="invisible" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/exchangelayout"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <TextView
            android:id="@+id/notrequired2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="From"
            android:textColor="#663300"
            android:visibility="invisible" />

        <EditText
            android:id="@+id/notrequired3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Current Location"
            android:visibility="invisible" />

        <Button
            android:id="@+id/exchange"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="right"
            android:background="@drawable/reverse" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/golayout"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <TextView
            android:id="@+id/place_tv"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Goto"
            android:textColor="#663300" />

        <EditText
            android:id="@+id/place_et"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:background="@drawable/urhereet"
            android:inputType="text" />

        <Button
            android:id="@+id/notrequired6"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/urherearrow"
            android:gravity="right"
            android:visibility="invisible" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/directionlayout"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dp"
        android:orientation="horizontal" >

        <TextView
            android:id="@+id/notrequired7"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="From"
            android:textColor="#663300"
            android:visibility="invisible" />

        <Button
            android:id="@+id/getdirection"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/getdirection" />

        <Button
            android:id="@+id/notrequired09"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="right"
            android:background="@drawable/urherearrow"
            android:visibility="invisible" />
    </LinearLayout>

    <RelativeLayout
        android:id="@+id/maplayout"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" >

        <com.google.android.maps.MapView
            android:id="@+id/mapview"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_alignParentTop="true"
            android:apiKey="0VV2WOyqkXNdui8250kVmtf5sYajGT1_CZ2jJqQ"
            android:clickable="true"
            android:enabled="true" />

        <Button
            android:id="@+id/large"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true"
            android:background="@drawable/large" >
        </Button>
    </RelativeLayout>

    <LinearLayout
        android:id="@+id/zoom"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true" />

</LinearLayout>

xml for image target.java


<?xml version="1.0" encoding="utf-8"?>
<!--
    In FrameLayout children are drawn in a stack, with the most recently
    added child on top.
   
    Due to a strange bug in Android, the z-order of the views does not seem to
    be guaranteed. For example, if we add the camera preview layer and the
    GLView here, first of all GLView has to be added to the layout BEFORE
    CameraPreview to be on top instead of vice versa due to a strange reason.  
    This works upon a fresh start, and the camera view sits underneath
    the GL view. However, upon pressing the HOME button and returning,
    the order of the layers gets swapped and stays wrong (or vice versa: if
    started with a wrong order, it gets correct).
   
    Apparently the current version of the framework makes no guarantees about
    what order the 2 SurfaceViews would be placed in the window manager, it is
    just happenstance, and could change based on various conditions that may or
    may not have the same result in the future...
   
    Calling the functions (available after Android 2.0)
    glView.setZOrderMediaOverlay(true) or using glView.bringToFront()
    doesn't seem to fix the problem either.
   
    To overcome this problem, we just construct the views dynamically upon
    calling onResume to guarantee the correct order and therefore leave the
    layout empty now.
























-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/fl"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <RelativeLayout
        android:id="@+id/combined"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >

        <FrameLayout
            android:id="@+id/frame"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" >
        </FrameLayout>

        <LinearLayout
            android:id="@+id/textlayout"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:gravity="center"
            android:orientation="horizontal"
            android:layout_centerInParent="true" >

            <LinearLayout
                android:id="@+id/layoutleft1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="left"
                android:gravity="left"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/left1"
                    android:layout_width="75dp"
                    android:layout_height="wrap_content" />

                <ImageView
                    android:id="@+id/imageleft1"
                    android:layout_width="72dp"
                    android:layout_height="72dp"
                     />
            </LinearLayout>

            <LinearLayout
                android:id="@+id/layoutleft2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="left"
                android:gravity="left"
                android:orientation="vertical"
                android:paddingLeft="20dp" >

                <TextView
                    android:id="@+id/left2"
                    android:layout_width="75dp"
                    android:layout_height="wrap_content"
                     />

                <ImageView
                    android:id="@+id/imageleft2"
                    android:layout_width="72dp"
                    android:layout_height="72dp"
                     />
            </LinearLayout>

            <LinearLayout
                android:id="@+id/layoutcenter"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:gravity="center_horizontal"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/tv"
                    android:layout_width="75dp"
                    android:layout_height="wrap_content" />

                <ImageView
                    android:id="@+id/imagecenter"
                    android:layout_width="72dp"
                    android:layout_height="72dp" />
            </LinearLayout>

            <LinearLayout
                android:id="@+id/layoutright2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="right"
                android:gravity="right"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/right2"
                    android:layout_width="75dp"
                    android:layout_height="wrap_content" />

                <ImageView
                    android:id="@+id/imageright2"
                    android:layout_width="72dp"
                    android:layout_height="72dp" />
            </LinearLayout>

            <LinearLayout
                android:id="@+id/layoutright1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="right"
                android:gravity="right"
                android:orientation="vertical"
                android:paddingRight="20dp" >

                <TextView
                    android:id="@+id/right1"
                    android:layout_width="75dp"
                    android:layout_height="wrap_content"
                    />

                <ImageView
                    android:id="@+id/imageright1"
                    android:layout_width="72dp"
                    android:layout_height="72dp" />
            </LinearLayout>
        </LinearLayout>
    </RelativeLayout>

</FrameLayout>