Skip to content

Instantly share code, notes, and snippets.

...
myHandler = new Handler() {
public void handleMessage(Message msg){
super.handleMessage(msg);
if(playSequence){
button1.setBackgroundDrawable(getResources().getDrawable(android.R.drawable.btn_default));
button2.setBackgroundDrawable(getResources().getDrawable(android.R.drawable.btn_default));
button3.setBackgroundDrawable(getResources().getDrawable(android.R.drawable.btn_default));
@seal308
seal308 / basicThread.java
Created July 2, 2016 14:38
basic thread, prints time in seconds
public class MainActivity extends Activity {
private Handler myHandler;
boolean gameOn;
long startTime;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
@seal308
seal308 / threadsMemory.java
Created July 2, 2016 14:31
exerpt of thread in memory game
myHandler = new Handler() {
public void handleMessage(Message msg){
super.handleMessage(msg);
if(playSequence){
button1.setBackgroundDrawable(getResources().getDrawable(android.R.drawable.btn_default));
button2.setBackgroundDrawable(getResources().getDrawable(android.R.drawable.btn_default));
button3.setBackgroundDrawable(getResources().getDrawable(android.R.drawable.btn_default));
button4.setBackgroundDrawable(getResources().getDrawable(android.R.drawable.btn_default));
<activity android:name=".MainActivity" android:screenOrientation = "portrait" android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".GameActivity" android:screenOrientation="portrait" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"></activity>
@seal308
seal308 / SoundsMain.java
Created June 21, 2016 04:59
Android sounds
public class MainActivity extends Activity implements View.OnClickListener{
private SoundPool soundPool;
int sample1 = -1;
int sample2 = -1;
int sample3 = -1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@seal308
seal308 / gist:1a975da8bb367ca837b3
Created September 15, 2015 16:43
image map code
<img id="Image-Maps-Com-image-maps-2015-09-15-122259" src="http://i927.photobucket.com/albums/ad111/seal308/Good%20Reads/good%20reads%20profile_zpsglcftnrh.png"
border="0" width="350" height="237" orgWidth="350" orgHeight="237" usemap="#image-maps-2015-09-15-122259" alt="" />
<map name="image-maps-2015-09-15-122259" id="ImageMapsCom-image-maps-2015-09-15-122259">
<area alt="" title="" href="https://www.goodreads.com/review/list/46821628" shape="rect" coords="201,153,314,175" style="outline:none;" target="_self" />
<area shape="rect" coords="348,235,350,237" alt="Image Map" style="outline:none;" title="Image Map" href="http://www.image-maps.com/index.php?aff=mapped_users_0" />
</map>