Skip to content

Instantly share code, notes, and snippets.

Antarix /
Created Jun 23, 2014
custom TimePreference dialog for preference activity
import android.content.Context;
import android.content.res.TypedArray;
import android.preference.DialogPreference;
import android.util.AttributeSet;
import android.view.View;
import android.widget.TimePicker;
public class TimePreference extends DialogPreference {
private int lastHour=0;
private int lastMinute=0;
Antarix / PhonegapPermission.xml
Created Jun 24, 2014
Permissons for Phongap. You should remove unwanted permissions before before publishing application to play store
View PhonegapPermission.xml
android:anyDensity="true" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
public class ContactsActivity extends Activity {
List<Contact> contacts;
ContactsAdapter contactsAdapter;
ListView contactsList;
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
View gist:0a32a0132eae19cf9470
// just add these few lines of code to your app delegate .m file right before the @implementation part
@implementation NSURLRequest (DSInvalidSSL)
+ (BOOL)allowsAnyHTTPSCertificateForHost:(NSString *)host {
return YES;
View gist:eb238c70e2ac46c96aeb
* Show the activity over the lockscreen and wake up the device. If you launched the app manually
* both of these conditions are already true. If you deployed from the IDE, however, this will
* save you from hundreds of power button presses and pattern swiping per day!
public static void riseAndShine(Activity activity) {
PowerManager power = (PowerManager) activity.getSystemService(POWER_SERVICE);
PowerManager.WakeLock lock =
Antarix / AES.c
Last active Aug 29, 2015 — forked from bricef/AES.c
View AES.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
* MCrypt API available online:
#include <mcrypt.h>
Antarix / OpacityHex.txt
Last active Aug 29, 2015
Opacity hex color code.
View OpacityHex.txt
100% — FF
95% — F2
90% — E6
85% — D9
80% — CC
75% — BF
70% — B3
65% — A6
60% — 99
55% — 8C
Antarix /
Last active Dec 12, 2015
fetches data from local Android xml folder having xml file and returns in Arraylist
public ArrayList<string> prepareListFromXml() {
ArrayList<string> todoItems = new ArrayList<string>();
XmlResourceParser todolistXml = getResources().getXml(R.xml.todolist);
int eventType = -1;
Antarix / round_background.xml
Created Feb 7, 2013
Round background image drawable for android
View round_background.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="" >
<shape xmlns:android="" android:shape="oval">
<stroke android:width="1dp" android:color="#FFFFFF" />