Android swedroid

2,534 views

Published on

My talk about Android and the problem that I've had with the platform, at IT-Huset Stockholm 2010-04-22.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,534
On SlideShare
0
From Embeds
0
Number of Embeds
84
Actions
Shares
0
Downloads
23
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Android swedroid

  1. 1. Hello World!
  2. 2. Photo: http://www.flickr.com/photos/toms/279820923/
  3. 3. 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
  4. 4. try { mHistoryDbAdapter = new HistoryDbAdapter(this).open(); } catch (Exception e) { showDialog(DIALOG_REINSTALL_APP); return; }
  5. 5. 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
  6. 6. 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)
  7. 7. /** * 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) {
  8. 8. Force Locale Resources res = getResources(); DisplayMetrics dm = res.getDisplayMetrics(); Configuration conf = res.getConfiguration(); conf.locale = new Locale("sv", "SE"); res.updateConfiguration(conf, dm);
  9. 9. 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
  10. 10. AndroidManifest.xml <activity android:name=".SearchDeparturesActivity" android:label="@string/departures" android:configChanges="locale" />
  11. 11. Photo: http://www.flickr.com/photos/travel_aficionado/4531677728/
  12. 12. 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)
  13. 13. 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>> { ... }
  14. 14. Photo: http://www.flickr.com/photos/laurapadgett/2807617588/sizes/l/
  15. 15. androidzoom.com
  16. 16. Photo: http://www.flickr.com/photos/library_mistress/1248479255/
  17. 17. iphone
  18. 18. 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/
  19. 19. Hackathon 1/5, 2010, 9:00 - 21:00

×