Hello World!
Photo: http://www.flickr.com/photos/toms/279820923/
Copy protection bug
02-04 08:55:19.262 E/AndroidRuntime( 5918): Uncaught handler: thread
main exiting due to uncaught exception
02-04 08:55:19.292 E/AndroidRuntime( 5918): java.lang.RuntimeException:
Unable to start activity ComponentInfo{com.markupartist.
sthlmtraveling/com.markupartist.sthlmtraveling.StartActivity}: java.lang.
RuntimeException: Unable to start activity ComponentInfo{com.
markupartist.sthlmtraveling/com.markupartist.sthlmtraveling.
PlannerActivity}: android.database.sqlite.SQLiteException: unable to open
database file




http://groups.google.com/group/android-
developers/browse_thread/thread/3c26247d7a0540d1
try {
   mHistoryDbAdapter = new HistoryDbAdapter(this).open();
} catch (Exception e) {
   showDialog(DIALOG_REINSTALL_APP);
   return;
}
Missing applications from Market

      "Har en 1.6 baserad lur och hittar inte sthlm
      traveling på market.
      Vet du varför. Hittar den med min 1.5 lur"




http://groups.google.com/group/android-
developers/browse_thread/thread/fd299f64638391e1

http://www.swedroid.se/forum/showthread.php?t=8247
java.lang.ClassCastException: android.graphics.drawable.BitmapDrawable
at com.google.android.maps.MyLocationOverlay.getLocationDot(MyLocationOverlay.java:180)
at com.google.android.maps.MyLocationOverlay.drawMyLocation(MyLocationOverlay.java:561)
at com.google.android.maps.MyLocationOverlay.draw(MyLocationOverlay.java:511)
at com.google.android.maps.OverlayBundle.draw(OverlayBundle.java:45)
at com.google.android.maps.MapView.onDraw(MapView.java:471)                               Spica
at android.view.View.draw(View.java:5838)
at android.view.ViewGroup.drawChild(ViewGroup.java:1486)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228)
at android.view.ViewGroup.drawChild(ViewGroup.java:1484)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228)
at android.view.View.draw(View.java:5841)
at android.widget.FrameLayout.draw(FrameLayout.java:352)
at android.view.ViewGroup.drawChild(ViewGroup.java:1486)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228)
at android.view.ViewGroup.drawChild(ViewGroup.java:1484)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228)
at android.view.View.draw(View.java:5841)
at android.widget.FrameLayout.draw(FrameLayout.java:352)
at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1898)
at android.view.ViewRoot.draw(ViewRoot.java:1217)
at android.view.ViewRoot.performTraversals(ViewRoot.java:1030)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1482)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3948)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
at dalvik.system.NativeStart.main(Native Method)
/**
* From the Android Developers group.
* http://groups.google.com/group/android-developers/msg/6cb65da690614662
*
* This class is a workaround for the MyLocationOverlay, that crashes on
* some devices, in my case I got reports from a Spica device.
*/
public class FixedMyLocationOverlay extends MyLocationOverlay {
   private boolean bugged = false;
   private Paint accuracyPaint;
   private Point center;
   private Point left;
   private Drawable drawable;
   private int width;
   private int height;

  public FixedMyLocationOverlay(Context context, MapView mapView) {
    super(context, mapView);
  }

  @Override
  protected void drawMyLocation(Canvas canvas, MapView mapView,
       Location lastFix, GeoPoint myLoc, long when) {
    if (!bugged) {
       try {
          super.drawMyLocation(canvas, mapView, lastFix, myLoc, when);
       } catch (Exception e) {
          bugged = true;
       }
    }
    if (bugged) {
       if (drawable == null) {
Force Locale

Resources res = getResources();
DisplayMetrics dm = res.getDisplayMetrics();
Configuration conf = res.getConfiguration();
conf.locale = new Locale("sv", "SE");
res.updateConfiguration(conf, dm);
Force locale for an application, bug in
2.0? - Kaj Bjurman
"No, changing the application's locale like this is not supported,
and will not entirely work. It shouldn't cause an activity to
restart though... actually I can't imagine how this would cause
an activity to restart, since this method is much lower-level than
the activity. Maybe the process is crashing for some reason in
this call? "

Dianne Hackborn
Android framework engineer

http://groups.google.com/group/android-
developers/browse_thread/thread/cb1dec87804d416/51780ca
c36e4fcf4
AndroidManifest.xml

<activity android:name=".SearchDeparturesActivity"
      android:label="@string/departures"
      android:configChanges="locale" />
Photo: http://www.flickr.com/photos/travel_aficionado/4531677728/
android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@464ff8a0 is no
at android.view.ViewRoot.setView(ViewRoot.java:472)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
at android.view.Window$LocalWindowManager.addView(Window.java:424)
at android.app.Dialog.show(Dialog.java:239)
at android.app.Activity.showDialog(Activity.java:2528)
at com.markupartist.sthlmtraveling.DeviationsActivity$GetDeviationsTask.onPostExecute(DeviationsActivity.java:338)
at com.markupartist.sthlmtraveling.DeviationsActivity$GetDeviationsTask.onPostExecute(DeviationsActivity.java:1)
at android.os.AsyncTask.finish(AsyncTask.java:417)
at android.os.AsyncTask.access$300(AsyncTask.java:127)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:429)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4595)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
at dalvik.system.NativeStart.main(Native Method)
AsyncTask
protected void onSaveInstanceState(Bundle outState) { ... }

private void saveGetDetailsTask(Bundle outState) {
   final GetDetailsTask task = mGetDetailsTask;
   if (task != null && task.getStatus() != AsyncTask.Status.FINISHED) {
       task.cancel(true);
       mGetDetailsTask = null;
       outState.putBoolean(STATE_GET_DETAILS_IN_PROGRESS, true);
   }
}

protected void onRestoreInstanceState(Bundle savedInstanceState) { ... }

private void restoreGetDetailsTask(Bundle savedInstanceState) {
   if (savedInstanceState.getBoolean(STATE_GET_DETAILS_IN_PROGRESS)) {
       mGetDetailsTask = new GetDetailsTask();
       mGetDetailsTask.execute(mRoute);
   }
}

protected void onDestroy() { ... }

private void onCancelGetDetailsTask() {
   if (mGetDetailsTask != null
        && mGetDetailsTask.getStatus() == AsyncTask.Status.RUNNING) {
       mGetDetailsTask.cancel(true);
       mGetDetailsTask = null;
   }
}

private class GetDetailsTask extends AsyncTask<Route, Void, ArrayList<String>> { ... }
Photo: http://www.flickr.com/photos/laurapadgett/2807617588/sizes/l/
androidzoom.com
Photo: http://www.flickr.com/photos/library_mistress/1248479255/
iphone
Crash Reporter

Since the admin console lacks crash reports consider
implementing a reporter yourself. There's several out there.

http://androidblogger.blogspot.com/2010/03/crash-reporter-for-
android-slight.html

http://code.google.com/p/android-remote-stacktrace/
Hackathon
1/5, 2010, 9:00 - 21:00

Android swedroid

  • 1.
  • 6.
  • 8.
    Copy protection bug 02-0408:55:19.262 E/AndroidRuntime( 5918): Uncaught handler: thread main exiting due to uncaught exception 02-04 08:55:19.292 E/AndroidRuntime( 5918): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.markupartist. sthlmtraveling/com.markupartist.sthlmtraveling.StartActivity}: java.lang. RuntimeException: Unable to start activity ComponentInfo{com. markupartist.sthlmtraveling/com.markupartist.sthlmtraveling. PlannerActivity}: android.database.sqlite.SQLiteException: unable to open database file http://groups.google.com/group/android- developers/browse_thread/thread/3c26247d7a0540d1
  • 9.
    try { mHistoryDbAdapter = new HistoryDbAdapter(this).open(); } catch (Exception e) { showDialog(DIALOG_REINSTALL_APP); return; }
  • 11.
    Missing applications fromMarket "Har en 1.6 baserad lur och hittar inte sthlm traveling på market. Vet du varför. Hittar den med min 1.5 lur" http://groups.google.com/group/android- developers/browse_thread/thread/fd299f64638391e1 http://www.swedroid.se/forum/showthread.php?t=8247
  • 12.
    java.lang.ClassCastException: android.graphics.drawable.BitmapDrawable at com.google.android.maps.MyLocationOverlay.getLocationDot(MyLocationOverlay.java:180) atcom.google.android.maps.MyLocationOverlay.drawMyLocation(MyLocationOverlay.java:561) at com.google.android.maps.MyLocationOverlay.draw(MyLocationOverlay.java:511) at com.google.android.maps.OverlayBundle.draw(OverlayBundle.java:45) at com.google.android.maps.MapView.onDraw(MapView.java:471) Spica at android.view.View.draw(View.java:5838) at android.view.ViewGroup.drawChild(ViewGroup.java:1486) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228) at android.view.ViewGroup.drawChild(ViewGroup.java:1484) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228) at android.view.View.draw(View.java:5841) at android.widget.FrameLayout.draw(FrameLayout.java:352) at android.view.ViewGroup.drawChild(ViewGroup.java:1486) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228) at android.view.ViewGroup.drawChild(ViewGroup.java:1484) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228) at android.view.View.draw(View.java:5841) at android.widget.FrameLayout.draw(FrameLayout.java:352) at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1898) at android.view.ViewRoot.draw(ViewRoot.java:1217) at android.view.ViewRoot.performTraversals(ViewRoot.java:1030) at android.view.ViewRoot.handleMessage(ViewRoot.java:1482) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:123) at android.app.ActivityThread.main(ActivityThread.java:3948) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:521) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540) at dalvik.system.NativeStart.main(Native Method)
  • 13.
    /** * From theAndroid Developers group. * http://groups.google.com/group/android-developers/msg/6cb65da690614662 * * This class is a workaround for the MyLocationOverlay, that crashes on * some devices, in my case I got reports from a Spica device. */ public class FixedMyLocationOverlay extends MyLocationOverlay { private boolean bugged = false; private Paint accuracyPaint; private Point center; private Point left; private Drawable drawable; private int width; private int height; public FixedMyLocationOverlay(Context context, MapView mapView) { super(context, mapView); } @Override protected void drawMyLocation(Canvas canvas, MapView mapView, Location lastFix, GeoPoint myLoc, long when) { if (!bugged) { try { super.drawMyLocation(canvas, mapView, lastFix, myLoc, when); } catch (Exception e) { bugged = true; } } if (bugged) { if (drawable == null) {
  • 14.
    Force Locale Resources res= getResources(); DisplayMetrics dm = res.getDisplayMetrics(); Configuration conf = res.getConfiguration(); conf.locale = new Locale("sv", "SE"); res.updateConfiguration(conf, dm);
  • 15.
    Force locale foran application, bug in 2.0? - Kaj Bjurman "No, changing the application's locale like this is not supported, and will not entirely work. It shouldn't cause an activity to restart though... actually I can't imagine how this would cause an activity to restart, since this method is much lower-level than the activity. Maybe the process is crashing for some reason in this call? " Dianne Hackborn Android framework engineer http://groups.google.com/group/android- developers/browse_thread/thread/cb1dec87804d416/51780ca c36e4fcf4
  • 16.
    AndroidManifest.xml <activity android:name=".SearchDeparturesActivity" android:label="@string/departures" android:configChanges="locale" />
  • 17.
  • 18.
    android.view.WindowManager$BadTokenException: Unable toadd window -- token android.os.BinderProxy@464ff8a0 is no at android.view.ViewRoot.setView(ViewRoot.java:472) at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177) at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91) at android.view.Window$LocalWindowManager.addView(Window.java:424) at android.app.Dialog.show(Dialog.java:239) at android.app.Activity.showDialog(Activity.java:2528) at com.markupartist.sthlmtraveling.DeviationsActivity$GetDeviationsTask.onPostExecute(DeviationsActivity.java:338) at com.markupartist.sthlmtraveling.DeviationsActivity$GetDeviationsTask.onPostExecute(DeviationsActivity.java:1) at android.os.AsyncTask.finish(AsyncTask.java:417) at android.os.AsyncTask.access$300(AsyncTask.java:127) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:429) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:123) at android.app.ActivityThread.main(ActivityThread.java:4595) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:521) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) at dalvik.system.NativeStart.main(Native Method)
  • 19.
    AsyncTask protected void onSaveInstanceState(BundleoutState) { ... } private void saveGetDetailsTask(Bundle outState) { final GetDetailsTask task = mGetDetailsTask; if (task != null && task.getStatus() != AsyncTask.Status.FINISHED) { task.cancel(true); mGetDetailsTask = null; outState.putBoolean(STATE_GET_DETAILS_IN_PROGRESS, true); } } protected void onRestoreInstanceState(Bundle savedInstanceState) { ... } private void restoreGetDetailsTask(Bundle savedInstanceState) { if (savedInstanceState.getBoolean(STATE_GET_DETAILS_IN_PROGRESS)) { mGetDetailsTask = new GetDetailsTask(); mGetDetailsTask.execute(mRoute); } } protected void onDestroy() { ... } private void onCancelGetDetailsTask() { if (mGetDetailsTask != null && mGetDetailsTask.getStatus() == AsyncTask.Status.RUNNING) { mGetDetailsTask.cancel(true); mGetDetailsTask = null; } } private class GetDetailsTask extends AsyncTask<Route, Void, ArrayList<String>> { ... }
  • 20.
  • 22.
  • 23.
  • 24.
  • 25.
    Crash Reporter Since theadmin console lacks crash reports consider implementing a reporter yourself. There's several out there. http://androidblogger.blogspot.com/2010/03/crash-reporter-for- android-slight.html http://code.google.com/p/android-remote-stacktrace/
  • 26.