Skip to content

Instantly share code, notes, and snippets.

View Bhavdip's full-sized avatar
🎯
Focusing

bhavdip Bhavdip

🎯
Focusing
View GitHub Profile
@Gautier
Gautier / CountDownTimer.java
Created December 12, 2010 00:58
Drop-in alternative for the Android CountDownTimer class, but which you can cancel from within onTick.
/*
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@mattbriancon
mattbriancon / DetectBufferTimeout.java
Created April 12, 2011 19:05
Spin up a thread to check whether MediaPlayer is buffering smoothly
boolean hasUpdated = false;
boolean doneBuffering = false;
long bufferTimeout = 500;
// put this somewhere smart
new Thread(new Runnable() {
public void run() {
while(!doneBuffering) {
Thread.sleep(bufferTimeout);
@nitindhar7
nitindhar7 / wait.xml
Created October 17, 2011 03:06
Animation frames in the res/drawable/ folder
<animation-list android:oneshot="false">
<item android:drawable="@drawable/wait_0" android:duration="50" />
<item android:drawable="@drawable/wait_1" android:duration="50" />
<item android:drawable="@drawable/wait_2" android:duration="50" />
<item android:drawable="@drawable/wait_3" android:duration="50" />
<item android:drawable="@drawable/wait_4" android:duration="50" />
<item android:drawable="@drawable/wait_5" android:duration="50" />
</animation-list>
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/irongrip"
android:tileMode="repeat" />
@nitindhar7
nitindhar7 / gist:1708545
Created January 31, 2012 03:23
Tab layout for the tutorial
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:id="@+id/tabcontainer"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
@ashtom
ashtom / HockeySender.java
Created March 1, 2012 09:26
Custom ReportSender for HockeyApp and ACRA
package net.hockeyapp.android.demo;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.acra.ACRA;
import org.acra.collector.CrashReportData;
import org.acra.ReportField;
import org.acra.sender.ReportSender;
@venkatesh05
venkatesh05 / customurl.xml
Created June 6, 2012 05:18
Custom Url schema android
<activity android:name=".SampleActivity"
android:label="sample" android:theme="@style/Theme.Titanium"
android:configChanges="keyboardHidden|orientation">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.LAUNCHER" />
<data android:scheme="mobileapp" />
</intent-filter>
@thuytrinh
thuytrinh / MainActivity.java
Last active September 21, 2020 01:22
Create carousel view with ViewPager
package com.thuytrinh.cardselectordemo;
import android.os.Bundle;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.app.Activity;
@devunwired
devunwired / background_dialog.xml
Created November 14, 2012 20:09
XML Shape Drawable for Dialog Backgrounds. Applies a fixed outer margin to keep background from fully stretching to screen edge, and allows for additional internal padding to apply to the dialog content.
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Apply the margin value on the "item" element -->
<!-- This example creates a 15dp visible margin around the dialog -->
<item
android:top="15dp"
android:bottom="15dp"
android:left="15dp"
android:right="15dp">
<shape
@Leandros
Leandros / HockeySender.java
Last active December 11, 2015 17:29 — forked from ashtom/HockeySender.java
Improved Gist
package net.hockeyapp.android.demo;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.acra.ACRA;
import org.acra.collector.CrashReportData;
import org.acra.ReportField;
import org.acra.sender.ReportSender;