Skip to content

Instantly share code, notes, and snippets.

protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
//normal OnCreate stuff
var persons = Person.GetAll();
var adapter = new PersonAdapter(this, persons);
// set adapter to listview and anything else that needs to happen
}
@eclipsed4utoo
eclipsed4utoo / gist:ac7b39c05e8d5c93563c
Created December 9, 2015 13:25
Xamarin stack trace
Forwarding debugger port 8810
Detecting existing process
[AndroidRuntime] Shutting down VM
[AndroidRuntime] FATAL EXCEPTION: main
[AndroidRuntime] Process: testapp.testapp, PID: 1842
[AndroidRuntime] java.lang.RuntimeException: Unable to get provider mono.MonoRuntimeProvider: java.lang.RuntimeException: Unable to find application Mono.Android.Platform.ApiLevel_23 or Xamarin.Android.Platform!
[AndroidRuntime] at android.app.ActivityThread.installProvider(ActivityThread.java:4777)
[AndroidRuntime] at android.app.ActivityThread.installContentProviders(ActivityThread.java:4369)
[AndroidRuntime] at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4309)
[AndroidRuntime] at android.app.ActivityThread.access$1500(ActivityThread.java:135)
@eclipsed4utoo
eclipsed4utoo / resize.cs
Last active December 16, 2021 14:18
Xamarin.Android Rotate and Resize
public static System.IO.Stream ResizeAndRotate(string filePath, int maxWidth, int maxHeight, float jpegQuality)
{
// loads just the dimensions of the file instead of the entire image
var options = new BitmapFactory.Options { InJustDecodeBounds = true };
BitmapFactory.DecodeFile (filePath, options);
int outHeight = options.OutHeight;
int outWidth = options.OutWidth;
int inSampleSize = 1;
@eclipsed4utoo
eclipsed4utoo / AirportCode
Created July 12, 2015 11:16
Json parsing
public class AirportCode
{
[JsonProperty("iata")]
public string IATA { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("lat")]
public decimal Latitude { get; set; }
[JsonProperty("lon")]
public decimal Longitude { get; set; }
string latitude = "0";
string longitude = "0";
locationmanager.LocationsUpdated += (object sender, CLLocationsUpdatedEventArgs e) =>
{
longitude = e.Locations [e.Locations.Length - 1].Coordinate.Longitude.ToString ();
latitude = e.Locations [e.Locations.Length - 1].Coordinate.Latitude.ToString ();
};
var data = await AppData.GetPlaceAutocomplete(input, double.Parse(latitude), double.Parse(longitude));
if (record.dirty) {
return false;
}
globalCounter++;
console.log("Counter: " + globalCounter);
// debugger;
// var groups = record.stores[0].getGroups();
// var currentGroupName = record.get("Status").Name;
var currentGroupName = record.get("Status").Name;
var group = record.stores[0].getGroups(currentGroupName);
@eclipsed4utoo
eclipsed4utoo / EmailActionSheet.js
Created June 5, 2015 21:10
Sencha Touch - MVC ActionSheet
Ext.define('TestApp.view.EmailActionSheet', {
extend: 'Ext.ActionSheet',
xtype: 'emailactionsheet',
config: {
itemId: 'emailactionsheet',
hideOnMaskTap: true,
items: [
{
text: 'Delete draft',
ui: 'decline'
private Ugi CurrentUgi
{
get { return Ugi.Singleton (); }
}
async partial void ConnectButton_TouchUpInside (UIButton sender)
{
if (!CurrentUgi.IsAnythingPluggedIntoAudioJack)
{
new UIAlertView ("Error", "Nothing plugged into audio port", null, "OK", null).Show ();
@eclipsed4utoo
eclipsed4utoo / gist:0af2be305e314b15fc27
Created February 5, 2015 20:00
Xamarin Insights Identify
public static void Identify(User currentUser)
{
if (currentUser != null)
{
var manyInfos = new Dictionary<string, string> {
{ Xamarin.Insights.Traits.Name, currentUser.FullName },
{ "App Version", currentUser.AppVersion },
{ "Server Version", currentUser.ServerVersion },
{ "Web Service URL", AppSettings.WebServiceURL },
{ "Database Server", currentUser.Server },
@eclipsed4utoo
eclipsed4utoo / gist:ff675b593c948a3df967
Created July 7, 2014 11:34
Base64 string of an image
/9j/4AAQSkZJRgABAQAAAQABAAD/4QBYRXhpZgAATU0AKgAAAAgAAgESAAMAAAABAAEAAIdpAAQAAAABAAAAJgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAACgKADAAQAAAABAAAB4AAAAAD/2wBDAB8VFxsXEx8bGRsjIR8lL04yLysrL19ESDhOcGN2dG5jbWt8jLKXfISphmttm9Odqbi+yMrIeJXb6tnC6bLEyMD/2wBDASEjIy8pL1syMlvAgG2AwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMD/wAARCAHgAoADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwCqAfSnBipxUwQUMB+NcnMmehyW6jA9OwrdqaQvf9Kcq7eQaljQhXb703Ge1PLfNyD9acCDRdjs