Skip to content

Instantly share code, notes, and snippets.

@codeguru42
codeguru42 / OnCreate.java
Created May 26, 2014 22:06
onItemClick()
this.oldCard = (BaseballCard) this.getIntent().getSerializableExtra(
this.getString(R.string.baseball_card_extra));
if (this.oldCard != null) {
this.isUpdating = true;
this.cardId = this.getIntent().getLongExtra(
this.getString(R.string.card_id_extra), -1L);
this.autographCheckBox.setChecked(this.oldCard.isAutographed());
06-04 16:06:31.808 2522-2522/bbct.android.common E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{bbct.android.common/bbct.android.common.activity.FilterCards}: java.lang.ClassCastException: bbct.android.common.activity.FilterCards cannot be cast to android.app.Activity
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1983)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
at android.app.ActivityThread.access$600(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
@codeguru42
codeguru42 / FilterCards.java
Last active August 29, 2015 14:02
testBrandCheckBox()
@Override
public void onPrepareOptionsMenu(Menu menu) {
MenuItem confirm = menu.findItem(R.id.save_menu);
if (this.numberChecked() > 0) {
confirm.setVisible(true);
confirm.setEnabled(true);
} else {
confirm.setVisible(false);
confirm.setEnabled(false);
@codeguru42
codeguru42 / IllegalAccessError.txt
Created June 7, 2014 04:05
IllegalAccessError
I/ActivityThread( 2051): Pub bbct.android.premium.provider: bbct.android.premium.provider.PremiumProvider
W/dalvikvm( 2051): Class resolved by unexpected DEX: Lbbct/android/premium/provider/PremiumProvider;(0xb5661828):0xad7a0000 ref [Lbbct/android/common/provider/BaseballCardProvider;] Lbbct/android/common/provider/BaseballCardProvider;(0xb5661828):0xad997000
W/dalvikvm( 2051): (Lbbct/android/premium/provider/PremiumProvider; had used a different Lbbct/android/common/provider/BaseballCardProvider; during pre-verification)
W/dalvikvm( 2051): Unable to resolve superclass of Lbbct/android/premium/provider/PremiumProvider; (951)
W/dalvikvm( 2051): Link of class 'Lbbct/android/premium/provider/PremiumProvider;' failed
D/AndroidRuntime( 2051): Shutting down VM
W/dalvikvm( 2051): threadid=1: thread exiting with uncaught exception (group=0xb4ea0288)
E/AndroidRuntime( 2051): FATAL EXCEPTION: main
E/AndroidRuntime( 2051): java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementati
com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException
at com.android.builder.testing.ConnectedDevice.installPackage(ConnectedDevice.java:82)
at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:112)
at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:42)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
@codeguru42
codeguru42 / testBackup.sh
Created June 15, 2014 03:23
Test Backup
#!/bin/bash
#verify command-line args
package = $1
apk = $2
adb install ${apk}
adb shell bmgr enable true
adb push bbct.db /data/data/${package}/databases
java.lang.RuntimeException
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2565)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2594)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1198)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4586)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
@codeguru42
codeguru42 / postVideoData.java
Last active August 29, 2015 14:04
postVideoData
@RequestMapping(method = RequestMethod.POST, value = "/video/{id}/data")
public Video postVideoData(@PathVariable("id") int videoId,
@RequestParam("data") MultipartFile videoData) throws IOException {
Video video = videos.get(videoId);
InputStream in = videoData.getInputStream();
manager.saveVideoData(video, in);
return video;
}
$ gradle robolectricTest
FAILURE: Build failed with an exception.
* Where:
Build file '/home/layne/dev/src/java/android/WADBCE/build.gradle' line: 5
* What went wrong:
A problem occurred evaluating root project 'WADBCE'.
> Could not find method jcenter() for arguments [] on repository container.
package atmos.tool2d;
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Pixmap.Format;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;