• Home
  • About
  • Contact Me
  • Projects
  • Post Categories

    • Android
    • Coding
    • Gadgets
    • gaming
    • Gaming
    • Life
    • Mobile
    • Reading
    • Web
  • Archives

    • August 2021 (1)
    • May 2021 (1)
    • January 2021 (1)
    • October 2020 (1)
    • February 2020 (1)
    • November 2019 (1)
    • April 2019 (1)
    • February 2019 (1)
    • November 2018 (1)
    • October 2018 (1)
    • May 2018 (1)
    • November 2017 (1)
    • January 2017 (1)
    • September 2016 (1)
    • January 2016 (1)
    • November 2015 (1)
    • February 2015 (1)
    • January 2015 (1)
    • December 2014 (2)
    • September 2014 (1)
    • March 2014 (1)
    • January 2012 (1)
    • September 2011 (1)
    • May 2011 (1)
    • April 2011 (1)
    • March 2011 (3)
    • February 2011 (2)
    • January 2011 (4)
    • December 2010 (3)
    • November 2010 (5)
  • Projects

    • SudoTape [Android]
    • CameraTest [Android]
  • What am I interested in?

    • @XboxGamePassPC welp, 15 hours down the drain. PC gamepass just upgraded my game and in the process deleted all my… https://t.co/Nojurp9OLv 3 years ago

    • Enter for a chance to win an incredible ASUS ZenFone 6 smartphone! https://t.co/8gLeZuw0xS 3 years ago

    • #LVLUP with a @NVIDIAGeForce powered one of a kind Custom Anthem PC by @CYBERPOWERPC @DIGITALSTORMPC @MAINGEAR and… https://t.co/lILFR29dBb 3 years ago

    • Yeah, no 3 years ago

    • RT @Fanatical: Our huge Summer Sale contest is here and you can win a PC Build worth $1500! Enter here: https://t.co/qjZtxOPLfA https://t.c… 4 years ago

    Powered by HL Twitter

Jan 09

What I’ve learned

Android, Coding Add comments

My project is coming along nicely.  I learned the hard way that the Android emulator is quite different than an actual device so when I got my phone back running my project on it pointed out a number of issues that I hadn’t thought of because they weren’t exposed with the emulator.

Here are some issues I tackled with recently:

  • If you have multiple <intent-filter sections in yourAndroidManifest.xml defining:

<action android:name=”android.intent.action.MAIN” />

<category android:name=”android.intent.category.LAUNCHER” />

then each of those sections will create icons for your application with no other identification saying which is which.. Can be a bit confusing on which icon to press to run what main mechanism

  • If you are launching an custom intent/activity from preferences DO NOT specify data= in your preferences.xml unless you are set to handle it, otherwise you will get a “cannot find activity” exception.  This took me several hours to discover, a lot of head scratching and swearing because I got lazy and never deleted the data= part that I copied from Google’s example code.
  • The bundle as the argument to onCreate() for your activity is actually very useful and tied to onSaveInstanceState(), this I supposed is common sense but no example I read actually showed them being used together so some digging exposed to me how to use it, very handy.
  • PreferenceManager.getDefaultSharedPreferences() is super easy to use, beats property file loading/saving which I use at work a lot.
  • My app is targeting Android 2.1 so I couldn’t use Camera.getNumberOfCameras().  I was using Camera.open() to find out if the device has a camera but not calling Camera.release() which caused some really strange exceptions later on in my code
  • this information on screens proved very important to several UI problems I was having (multi-touch), should be fundamental reading for anyone learning Android programming.

Leave a Reply

Proudly powered by WordPress.

cssandhtml