This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export PATH="$PATH:~/scripts" | |
# export PATH="$PATH:~/Downloads/AndroidSDK/platform-tools/adb" | |
export PATH=/opt/local/bin:/opt/local/sbin:$PATH | |
# export PATH="$PATH:~/Downloads/AndroidSDK/platform-tools:~/Downloads/AndroidSDK/tools:~/Downloads/AndroidSDK/platform-tools/adb" | |
export PATH="$PATH:~/Downloads/android-sdk-mac_x86/tools" | |
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin:/.rvm/scripts/rvm:/.rvm/scripts/rvm:/~/Downloads/AndroidSDK/tools/android:/~/Downloads/android-ndk-r7:$PATH | |
export CC=gcc-4.2 | |
export PATH=~/Downloads/android-ndk-r7:$PATH | |
export PATH=~/Downloads/android-sdk-mac_x86/tools:$PATH |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static final int FOO_BUTTON_ID = 1; | |
private static final int BAR_BUTTON_ID = 2; | |
private ArrayList<View> views = new ArrayList<View>(); | |
public void onCreate(Bundle state) { | |
View v = findViewById(R.id.myView); | |
if(myDatabase.contains(foo)) { | |
Button b = new Button(this); | |
v.addView(b); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
somewhere in my Android activity: | |
new Button().setOnClickListener( | |
new OnClickListener() { | |
public void onClick(View v) { | |
println(v.getId + "was clicked"); | |
} | |
} | |
public interface OnClickListener(View v); //no method body defined |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//java | |
List list = new List(1, 2, 5, 3); | |
Comparator myComparator = new Comparator() { | |
public void compare(Object this, Object that) { | |
return this > that; | |
} | |
} | |
Collections.sort(list, myComparator); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
151 | |
07-03 15:46:31.557: E/AndroidRuntime(5700): at android.os.Parcel.writeSerializable(Parcel.java:1176) | |
152 | |
07-03 15:46:31.557: E/AndroidRuntime(5700): at android.os.Parcel.writeValue(Parcel.java:1130) | |
153 | |
07-03 15:46:31.557: E/AndroidRuntime(5700): at android.os.Parcel.writeMapInternal(Parcel.java:488) | |
154 | |
07-03 15:46:31.557: E/AndroidRuntime(5700): at android.os.Bundle.writeToParcel(Bundle.java:1552) | |
155 | |
07-03 15:46:31.557: E/AndroidRuntime(5700): at android.os.Parcel.writeBundle(Parcel.java:502) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
149 | |
07-03 15:46:31.557: E/AndroidRuntime(5700): FATAL EXCEPTION: main | |
150 | |
07-03 15:46:31.557: E/AndroidRuntime(5700): java.lang.RuntimeException: Parcelable encountered IOException writing serializable object (name = java.net.ConnectException) | |
151 | |
07-03 15:46:31.557: E/AndroidRuntime(5700): at android.os.Parcel.writeSerializable(Parcel.java:1176) | |
152 | |
07-03 15:46:31.557: E/AndroidRuntime(5700): at android.os.Parcel.writeValue(Parcel.java:1130) | |
153 | |
07-03 15:46:31.557: E/AndroidRuntime(5700): at android.os.Parcel.writeMapInternal(Parcel.java:488) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sumOfDigits(n: Int) = { | |
@annotation.tailrec def sumOfDigitsAcc(n: Int, acc: Int):Int = { | |
n match { | |
case 0 => n + acc | |
case _ => sumOfDigitsAcc(n/10, acc + (n%10)) | |
} | |
} | |
sumOfDigitsAcc(n, 0) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sumOfDigits(n: Int) = { | |
@annotation.tailrec def sumOfDigitsAcc(n: Int, acc: Int = 0):Int = { | |
n match { | |
case 0 => acc | |
case _ => sumOfDigitsAcc(n/10, acc + (n%10)) | |
} | |
} | |
sumOfDigitsAcc(n) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sumOfDigits(n: Int) = { | |
@annotation.tailrec def sumOfDigitsAcc(n: Int, acc: Int = 0):Int = { | |
n match { | |
case 0 => acc | |
case _ => sumOfDigitsAcc(n/10, acc + (n%10)) | |
} | |
} | |
sumOfDigitsAcc(n) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sumOfDigits(n: Int) = { | |
@annotation.tailrec def sumOfDigitsAcc(n: Int, acc: Int):Int = { | |
n match { | |
case 0 => n + acc | |
case _ => sumOfDigitsAcc(n/10, acc + (n%10)) | |
} | |
} | |
sumOfDigitsAcc(n, 0) | |
} |