Skip to content

Instantly share code, notes, and snippets.

Chris Black blackcj

Block or report user

Report or block blackcj

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@blackcj
blackcj / MainActivity.java
Last active Aug 3, 2019
Design support library with CoordinatorLayout, SwipeRefreshLayout and RecyclerView.
View MainActivity.java
import android.os.Bundle;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.TabLayout;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import com.blackcj.designsupportexample.adapters.RecyclerViewAdapter;
@blackcj
blackcj / ActivityEventListener.md
Created Aug 15, 2013
Demonstrates how to call a function in the parent Activity from within a Fragment.
View ActivityEventListener.md

Step 1: Add any functions you want to call into the interface (EventListener).

Step 2: Implement those functions in your MainActivity.

Step 3: Create the listener in your Fragment and attach it to the Activity.

Step 4: Call any functions on the listener.

View SingletonDatabase.java
/**
* create custom DatabaseHelper class that extends SQLiteOpenHelper
*/
public class DatabaseHelper extends SQLiteOpenHelper {
private static DatabaseHelper mInstance = null;
private static final String DATABASE_NAME = "databaseName";
private static final String DATABASE_TABLE = "tableName";
private static final int DATABASE_VERSION = 1;
@blackcj
blackcj / gcm_sender.html
Last active Mar 4, 2016
Used to send test messages through Google Cloud Messaging to an Android app.
View gcm_sender.html
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>GCM Sender</title>
</head>
<body>
<h2>GCM Sender</h2>
<form method="POST" name="input" action="gcm_sender.php" />
@blackcj
blackcj / AppViewPager.java
Created Jul 9, 2013 — forked from pboos/MainActivity.java
ViewPager and PagerTabStrip
View AppViewPager.java
package ch.pboos.android.sample.viewpager;
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.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
You can’t perform that action at this time.