Skip to content

Instantly share code, notes, and snippets.

View doneill's full-sized avatar
🏔️

Dan O'Neill doneill

🏔️
View GitHub Profile
@doneill
doneill / Callout.java
Last active August 29, 2015 14:05
Show/Hide a Callout
/**
* Shows a mini callout on the map.
*
* @param location
* the location of the callout
* @param message
* the content of the callout
* @param yOffsetDips
* the y offset of the callout in dips
*/
@doneill
doneill / simple_callout.xml
Created August 14, 2014 21:25
Simple Callout Layout file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="5dp" >
@doneill
doneill / QueryFeatureLayer.java
Created September 14, 2012 21:01
Query features from ArcGIS Feature Layer in Android
/*
* Query features from the feature layer
*/
private void queryFeatureLayer(){
// create a Query
Query query = new Query();
// set spatial reference
SpatialReference sr = SpatialReference.create(102100);
// set the geometry to the sketch polygon
query.setGeometry(selection);
@doneill
doneill / PlaceSearch.java
Created March 13, 2013 22:58
ArcGIS Android Geocoding and Place Searching
// Get parameters on the UI thread
LocatorFindParameters findParams = new LocatorFindParameters("Yankee Stadium");
// Run locator task off UI thread, e.g. AsyncTask
Locator locator = new Locator();
try {
results = locator.find(params[0]);
}catch (Exception e) {
e.printStackTrace();
}
@doneill
doneill / FetchBasemaps.java
Created May 2, 2013 01:36
Get ArcGIS online basemaps from default account
private void fetchBasemaps() throws Exception {
String url = "http://www.arcgis.com";
Portal portal = new Portal(url, null);
// get the information provided by portal
PortalInfo portalInfo = portal.fetchPortalInfo();
// get query to determine which basemap gallery group should be used
// in client
String basemapGalleryGroupQuery = portalInfo
@doneill
doneill / WebViewDialogFragment.java
Created September 26, 2013 00:08
Authenticate OAuth2 ArcGIS Services in Android
public class WebViewDialogFragment extends DialogFragment {
// The redirect_uri can be either a special value of urn:ietf:wg:oauth:2.0:oob
// or an application-specific custom URI that is handled on the device.
private static final String REDIRECT_URI = "";
// OAuth2 client_id = APPID
private static final String CLIENT_ID = "";
String username;
String access_token;
String refresh_token;
@doneill
doneill / adb.sh
Created November 23, 2016 21:39
Android adb commands
# you will find some related property for check the device is 32bit or 64bit
# ro.product.cpu.abilist32
# ro.product.cpu.abilist64
# ro.product.cpu.abilist
# getprop is an android utility to retrieve a property via the android property service.
adb shell getprop
# ro.product.cpu.abi is android property, this property could help you confirm this device is ARM or Intel x86
adb shell getprop ro.product.cpu.abi
@doneill
doneill / pom.xml
Created January 19, 2017 23:45
ArcGIS Java Maven configuration
<project>
<!-- Project configuration... -->
<repositories>
<repository>
<id>esri-arcgis</id>
<url>https://esri.bintray.com/arcgis</url>
</repository>
</repositories>
<pluginRepositories>
@doneill
doneill / alpental.geojson
Last active January 31, 2017 22:37
Alpental Features
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@doneill
doneill / ImmutablePart.java
Created February 18, 2017 05:44
Test immutable parts in Android SDK
// inflate MapView from layout
mMapView = (MapView) findViewById(R.id.mapView);
// create an ArcGISMap with BasemapType topo
final ArcGISMap map = new ArcGISMap(Basemap.Type.DARK_GRAY_CANVAS_VECTOR, 65.783988, -83.447820, 6);
pointCollectionOne = new PointCollection(SpatialReference.create(102113));
pointCollectionOne.add(-9080995.6424, 9910570.681900002);
pointCollectionOne.add(-9349175.207599999, 9361330.556400001);
pointCollectionOne.add(-9236116.532600001, 10398421.5554);