Skip to content

Instantly share code, notes, and snippets.

@Cyberloki
Cyberloki / Working with AsyncTasks on Android.java
Created September 26, 2013 22:41
Working with AsyncTasks on Android
Working with AsyncTasks on Android
from category Android
Introduction
Developing Android applications is a lot of fun because it offers a lot of possibilities to implement one's own ideas. Frequently i have to use AsyncTasks to do heavy work aside the ui thread. In the following i give a quick overview on AsyncTasks and provide some code snippets that might be useful for everyday development with Android regarding the use of AsyncTasks.
Lifecycle
An AsyncTask in Android is used to perform background operations and publish results on the UI thread without having to manipulate threads and/or handlers (more information). The structure follows call onPreExecute() for preparation, doInBackground() for doing the main task and return its result finally to the onPostExecute() method. Optional you can implement the onProgressUpdate() method e.g. to show a progressbar.
The following example can be used as template for an AsyncTask.
private class MyTask extends AsyncTask<Object, Void, Object> {
@Cyberloki
Cyberloki / RegEx_CSV_Record_Fields
Created October 4, 2013 02:11
RegEx CSV Record fields Uses a regex to pick out the fields the delimiter and "quote" is passed in also You can then reference each "field" using the public "Fields" property Otherwise, you can use the GetResultsFromExpression() method which accepts field references such as {{1}} for field 1 or {{2}} for field 2 Therefore you can combine multipl…
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace EDI.Import
{
public class CSVRecord
{
C# Regular Expressions Cheat Sheet
Cheat sheet for C# regular expressions metacharacters, operators, quantifiers etc
Character
Description
\
@Cyberloki
Cyberloki / png_sprite_with_transparency
Created October 9, 2013 21:55
PNG Sprite with transparency Create a Sprite set (vertical set of multiple images) with a CSS reference for use in Icenium for instance
Make sure the individual PNG images have transparency
http://watermark.algid.net/en/create-transparent-png.php
Pack the images into a sprite png, and get the CSS
http://cly.jsser.com/sprites/
Make buttons
http://dabuttonfactory.com/
http://cooltext.com/
@Cyberloki
Cyberloki / API.md
Created April 7, 2017 03:23 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method: