Skip to content

Instantly share code, notes, and snippets.

<activity
android:name=".DangerousActivity"
android:label="@string/app_name"
android:permission="course.labs.permissions.DANGEROUS_ACTIVITY_PERM" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
02-05 16:33:31.974: I/Lab-Fragments(2565): Entered onItemSelected(0)
02-05 16:33:32.324: I/Lab-Fragments(2565): Entered updateFeedDisplay()
02-05 16:33:34.614: I/Lab-Fragments(2565): Entered onActivityCreated()
02-05 16:33:36.454: I/Lab-Fragments(2565): Entered onItemSelected(1)
02-05 16:33:36.454: I/Lab-Fragments(2565): Entered updateFeedDisplay()
02-05 16:33:39.074: I/Lab-Fragments(2565): Entered onActivityCreated()
02-05 16:33:40.404: I/Lab-Fragments(2565): Entered onItemSelected(2)
02-05 16:33:40.404: I/Lab-Fragments(2565): Entered updateFeedDisplay()
Bundle b = new Bundle();
b.setString("name", name);
b.setInt("someInt", someInt);
Message m = new Message();
m.setData(b);
03-01 10:54:44.479: E/AndroidRuntime(1656): java.lang.RuntimeException: Unable to pause activity {course.labs.notificationslab/course.labs.notificationslab.MainActivity}: java.lang.IllegalArgumentException: Receiver not registered: null
03-01 10:54:44.479: E/AndroidRuntime(1656): at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2838)
03-01 10:54:44.479: E/AndroidRuntime(1656): at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2794)
03-01 10:54:44.479: E/AndroidRuntime(1656): at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:2772)
03-01 10:54:44.479: E/AndroidRuntime(1656): at android.app.ActivityThread.access$800(ActivityThread.java:130)
03-01 10:54:44.479: E/AndroidRuntime(1656): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1212)
03-01 10:54:44.479: E/AndroidRuntime(1656): at android.os.Handler.dispatchMessage(Handler.java:99)
03-01 10:54:44.479: E/AndroidRuntime(1656): at android.os.Looper.loop(Looper.java:137)
03-01
@codeguru42
codeguru42 / dynamicMapFragment
Created March 8, 2014 03:04
Dynamic Map Fragment
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
GoogleMapOptions options = new GoogleMapOptions()
.mapType(GoogleMap.MAP_TYPE_SATELLITE);
SupportMapFragment mapFragment = SupportMapFragment
.newInstance(options);
GoogleMap map = mapFragment.getMap();
@codeguru42
codeguru42 / map_activity.xml
Created March 8, 2014 03:45
A MapFragment with a Button
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<Button
android:id="@+id/next_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
// Top-level build file where you can add configuration options common to all sub-projects/modules.
apply plugin: 'java'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
@codeguru42
codeguru42 / onResume.java
Created April 13, 2014 17:06
onResume()
@Override
public void onResume() {
super.onResume();
// restore default header state
CheckedTextView headerCheck = (CheckedTextView) this.headerView
.findViewById(R.id.checkmark);
headerCheck.setChecked(false);
boolean[] newSelection = new boolean[this.adapter.getCount()];
fibd n m = sum $ fibd' !! (n-1)
where fibd' = [[fibd'' i j | i <- [0..m]] | j <- [0..n]]
-- `fibd'' i j` is the number of rabbits which are `i` months old after `j` months since the first generation
fibd'' 0 0 = 1
fibd'' _ 0 = 0
fibd'' 0 j = sum . tail $ fibd' !! (j-1)
fibd'' i j = fibd' !! (j-1) !! (i-1)
main = do
print $ fibd n m
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="codeguru.thecubeserver.app.ChatFragment">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/hello_blank_fragment"/>