This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int main(int argc, char** argv) { | |
puts("Hello Gist!"); | |
return EXIT_SUCCESS; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<!-- AndroidManifest.xml --> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="com.example" | |
android:versionCode="1" | |
android:versionName="1.0"> | |
<uses-sdk android:minSdkVersion="8"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example; | |
import android.app.Activity; | |
import android.content.Context; | |
import android.location.Location; | |
import android.app.ProgressDialog; | |
import android.location.LocationListener; | |
import android.location.LocationManager; | |
import android.os.AsyncTask; | |
import android.os.Bundle; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<string name="app_name">MapsListing</string> | |
<string name="httptestlist_textview">Please Wait...</string> | |
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HttpTestActivity extends Activity { | |
private String latitude; | |
private String longitude; | |
private String provider; | |
private final String APIKEY = //PLACE YOUR API_KEY HERE! | |
private final int radius = 2000; | |
private String type = "food"; | |
private StringBuilder query = new StringBuilder(); | |
private ArrayList<Place> places = new ArrayList<Place>(); | |
private ListView listView; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.httptestlist); | |
LocationManager locationManager = (LocationManager) getSystemService( | |
Context.LOCATION_SERVICE); | |
LocationListener myLocationListener = new MyLocationListener(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Document loadXMLFromString(String xml) throws Exception { | |
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); | |
DocumentBuilder builder = factory.newDocumentBuilder(); | |
InputSource is = new InputSource(new StringReader(xml)); | |
return builder.parse(is); | |
} | |
private class GetCurrentLocation extends AsyncTask<Object, String, Boolean> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Based on: http://stackoverflow.com/questions/3505930 | |
*/ | |
private class QueryGooglePlaces extends AsyncTask<String, String, String> { | |
@Override | |
protected String doInBackground(String... args) { | |
HttpClient httpclient = new DefaultHttpClient(); | |
HttpResponse response; | |
String responseString = null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onPostExecute(String result) { | |
super.onPostExecute(result); | |
try { | |
Document xmlResult = loadXMLFromString(result); | |
NodeList nodeList = xmlResult.getElementsByTagName("result"); | |
for(int i = 0, length = nodeList.getLength(); i < length; i++) { | |
Node node = nodeList.item(i); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Represents a single Result of a places API call | |
* https://developers.google.com/places/documentation/search | |
* This class was mostly auto-generated by IntelliJ IDEA | |
*/ | |
private class Place { | |
public String vicinity; | |
public float[] geometry; //array(0 => lat, 1 => lng) | |
public String id; | |
public String name; |
OlderNewer