Skip to content

Instantly share code, notes, and snippets.

View fredgrott's full-sized avatar
👾
focusing on flutter cross platform mobile dev

Fred Grott fredgrott

👾
focusing on flutter cross platform mobile dev
View GitHub Profile
@caseycrites
caseycrites / AsyncTest.Java
Created July 10, 2012 15:52
Properly test async Android code
/*
I've been writing tests for Android code that uses Handlers to communicate with background threads.
I couldn't get my callbacks to be called back to.
I got angry.
I finally found the solution...after way too much looking.
Here it is.
*/
package com.caseycrites.android.testexample
@fjfish
fjfish / SearchableAdapter.java
Created June 30, 2012 15:48
Simple String Adapter for Android ListView that has a filter that gives whatever it finds and ignores word boundaries
package com.yourco.yourapp;
import java.util.ArrayList;
import java.util.List;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
@razarahil
razarahil / MainActivity.java
Created June 25, 2012 15:45 — forked from romannurik/SwipeDismissListViewTouchListener.java
**BETA** Android 4.0-style "Swipe to Dismiss" sample code
// THIS IS A BETA! I DON'T RECOMMEND USING IT IN PRODUCTION CODE JUST YET
/*
* Copyright 2012 Roman Nurik
*
* 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
@kaz-tk
kaz-tk / gist:2722565
Created May 18, 2012 01:20
Use Emulator Console in MonkeyRunner
# -*- coding:utf-8 -*-
# author :Kazushige TAKEUCHI(@myb1126)
import sys
import os
# おまじない1
srcroot = os.path.dirname(__file__)
sys.path.append(srcroot)
@kaz-tk
kaz-tk / gist:2626506
Created May 7, 2012 07:35
MonkeyRunnerからDeviceの取得
# これからWaitForConnectionすればいい感じ
from java.io import File
from java.net import URL
from java.net import URLClassLoader
import jarray
urlClassLoader=URLClassLoader(jarray.array([File("ddmlib.jar").toURL()], URL))
AndroidDebugBridge=urlClassLoader.loadClass("com.android.ddmlib.AndroidDebugBridge")
bridge = AndroidDebugBridge.getBridge()
@kimukou
kimukou / GridViewActivity.java
Created May 4, 2012 00:47
GridView MultiTouch Test
/*
* ref
* http://www.mkyong.com/android/android-gridview-example/
* http://blog.fujiu.jp/2011/11/android.html
* http://d.hatena.ne.jp/xuwei/20120316/1331868246
* http://stackoverflow.com/questions/5730240/android-get-bounding-rectangle-of-a-view
*/
@graetzer
graetzer / ActionbarTabsPager.java
Created April 19, 2012 21:39
Android FragmentTabsPager with Actionbarsherlock
import java.util.ArrayList;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.ViewPager;
@daichan4649
daichan4649 / MainActivity.java
Created April 17, 2012 12:35
DialogFragment sample
package test.fragment;
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
public class MainActivity extends Activity {
@romannurik
romannurik / button_bar_layout.xml
Created April 10, 2012 04:24
How to make a proper button bar on ICS
<!--
A button bar is a set of buttons at the bottom of an activity.
An example is an AlertDialog with OK/Cancel buttons.
Note that something similar can be accomplished using a
split action bar and text-only action buttons, but this is an
alternate presentation that's often preferred.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
@fjolnir
fjolnir / tlc.lua
Last active September 29, 2024 14:57
LuaJIT ObjC bridge
The bridge is now located at https://github.com/fjolnir/TLC