use of app.akexorcist.gdaplibrary.GooglePlaceSearch.OnPlaceResponseListener in project Android-GoogleDirectionAndPlaceLibrary by akexorcist.
the class PlaceActivity3 method onCreate.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_place_1);
textStatus = (TextView) findViewById(R.id.textStatus);
listView = (ListView) findViewById(R.id.listView);
gp = new GooglePlaceSearch(ApiKey);
gp.setOnPlaceResponseListener(new OnPlaceResponseListener() {
public void onResponse(String status, ArrayList<ContentValues> arr_data, Document doc) {
textStatus.setText("Status : " + status);
if (status.equals(GooglePlaceSearch.STATUS_OK)) {
ArrayList<String> array = new ArrayList<String>();
final ArrayList<String> array_photo = new ArrayList<String>();
for (int i = 0; i < arr_data.size(); i++) {
array.add("Name : " + arr_data.get(i).getAsString(GooglePlaceSearch.PLACE_NAME) + "\n" + "Address : " + arr_data.get(i).getAsString(GooglePlaceSearch.PLACE_ADDRESS) + "\n" + "Latitude : " + arr_data.get(i).getAsString(GooglePlaceSearch.PLACE_LATITUDE) + "\n" + "Longitude : " + arr_data.get(i).getAsString(GooglePlaceSearch.PLACE_LONGITUDE) + "\n" + "Phone Number : " + arr_data.get(i).getAsString(GooglePlaceSearch.PLACE_PHONENUMBER));
array_photo.add(arr_data.get(i).getAsString(GooglePlaceSearch.PLACE_PHOTO));
}
ArrayAdapter<String> adapter = new ArrayAdapter<String>(PlaceActivity3.this, R.layout.listview_text, array);
listView.setAdapter(adapter);
listView.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
Dialog dialog = new Dialog(PlaceActivity3.this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.dialog_photo);
dialog.setCancelable(true);
final ImageView imgPhoto = (ImageView) dialog.findViewById(R.id.imgPhoto);
dialog.show();
gp.getPhotoBitmapByWidth(array_photo.get(arg2), 600, "", new OnBitmapResponseListener() {
public void onResponse(Bitmap bm, String tag) {
imgPhoto.setImageBitmap(bm);
}
});
}
});
}
}
});
gp.getNearby(latitude, longitude, radius, type, language, keyword);
}
use of app.akexorcist.gdaplibrary.GooglePlaceSearch.OnPlaceResponseListener in project Android-GoogleDirectionAndPlaceLibrary by akexorcist.
the class PlaceActivity1 method onCreate.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_place_1);
textStatus = (TextView) findViewById(R.id.textStatus);
listView = (ListView) findViewById(R.id.listView);
gp = new GooglePlaceSearch(ApiKey);
gp.setOnPlaceResponseListener(new OnPlaceResponseListener() {
public void onResponse(String status, ArrayList<ContentValues> arr_data, Document doc) {
textStatus.setText("Status : " + status);
if (status.equals(GooglePlaceSearch.STATUS_OK)) {
ArrayList<String> array = new ArrayList<String>();
for (int i = 0; i < arr_data.size(); i++) {
array.add("Name : " + arr_data.get(i).getAsString(GooglePlaceSearch.PLACE_NAME) + "\n" + "Address : " + arr_data.get(i).getAsString(GooglePlaceSearch.PLACE_ADDRESS) + "\n" + "Latitude : " + arr_data.get(i).getAsString(GooglePlaceSearch.PLACE_LATITUDE) + "\n" + "Longitude : " + arr_data.get(i).getAsString(GooglePlaceSearch.PLACE_LONGITUDE) + "\n" + "Phone Number : " + arr_data.get(i).getAsString(GooglePlaceSearch.PLACE_PHONENUMBER));
}
ArrayAdapter<String> adapter = new ArrayAdapter<String>(PlaceActivity1.this, R.layout.listview_text, array);
listView.setAdapter(adapter);
}
}
});
gp.getNearby(latitude, longitude, radius, type, language, keyword);
//gp.getTextSearch(keyword, type, false, language);
//gp.getRadarSearch(latitude, longitude, radius, type, language, false, keyword);
}
use of app.akexorcist.gdaplibrary.GooglePlaceSearch.OnPlaceResponseListener in project Android-GoogleDirectionAndPlaceLibrary by akexorcist.
the class PlaceActivity2 method onCreate.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_place_2);
mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(latitude, longitude), 15));
gp = new GooglePlaceSearch(ApiKey);
gp.setOnPlaceResponseListener(new OnPlaceResponseListener() {
public void onResponse(String status, ArrayList<ContentValues> arr_data, Document doc) {
Toast.makeText(getApplicationContext(), status, Toast.LENGTH_SHORT).show();
if (status.equals(GooglePlaceSearch.STATUS_OK)) {
for (int i = 0; i < arr_data.size(); i++) {
String title = arr_data.get(i).getAsString(GooglePlaceSearch.PLACE_NAME);
double lat = arr_data.get(i).getAsDouble(GooglePlaceSearch.PLACE_LATITUDE);
double lng = arr_data.get(i).getAsDouble(GooglePlaceSearch.PLACE_LONGITUDE);
LatLng pos = new LatLng(lat, lng);
mMap.addMarker(new MarkerOptions().position(pos).title(title));
}
}
}
});
gp.getNearby(latitude, longitude, radius, type, language);
//gp.getRadarSearch(latitude, longitude, radius, type, language, false);
}
Aggregations