Author Archives: shellström

SmartWatch2+3 in one apk

So, I got into this thing when I developed a watch face for the SmartWatch 2 and wanted to see if I could combine it in any way to work with a SmartWatch 3 as well.

My route was a bit more strangled than the one I am about to present, but if nothing else, now that I’ve done that, you don’t have to!

Primary setup

The ingredients list, as of this writing, is straight forward. This is what you need before moving on:

  • Android Studio 1.0.2
  • Android SDK Tools 23.0.5
  • Android SDK Platform-tools 21
  • Sony Add-on SDK 3.0
  • Android SDK 5.0 (API21)

Step 1: Create a Wear (API21: Android 5.0) project

This is for the SmartWatch 3 part of this SmartWatch 2 and 3 mashup.

It is actually as simple as that sounds. In Android Studio, choose the File-menu -> New Project and decide what you’d like to name it along with all the other settings you’d like to use for your SmartWatch 3 project. NOTE! The package name is going to be extra important, as you will have to use that later on in this guide.

When you have ran through the wizard and managed to find yourself with a Wear project that compiles, let’s import a SmartExtensions project.

Step 2: Import one of the SmartExtension samples as a module

Using a sample project is a quick and easy way of getting the right dependencies in place for the SmartWatch 2 part of this mashup.

Importing a sample project is done by clicking the File-menu -> Import-module, browsing to the SmartExtensions sample folder directory (usually located in ANDROID_SDK/add-ons/addon-sony_add-on_sdk_3_0-sony-19/samples/SmartExtensions) and selecting one of the samples. The import wizard will automatically present you with the option of also importing the “SmartExtensionUtils” and “SmartExtensionAPI” projects. Make sure that you include these, or you will run into build issues because of missing dependencies.

NOTE! I chose the “HelloLayouts” sample during my tests. Any other sample should work but avoid importing the “SmartExtensionAPI” and “SmartExtensionUtils” projects, unless you want to create a project from scratch without any boiler plate setup from the samples.

Step 3: Do a bit of modifications to project files

Here’s the tricky part. It’s not that tricky though. You will need to:

  • Modify the SmartExtension sample package name
  • Creating release build signing configs

and do some edits to the following files:

  • The SmartExtension sample gradle file
  • The SmartExtension sample AndroidManifest

Modifying the package name

This took a bit of trial and error but in the end, the recipe I would use:

  1. Create a new package in the SmartExtension sample module that has the same name as the Wear module package name
  2. Drag-and-drop all the classes from the old package “com.example….hellolayouts” to the new package
  3. Delete the old package
  4. Open the AndroidManifest file in the SmartExtension sample and replace the old package name “com.example….hellolayouts” the new name
  5. Open the SmartExtension gradle file and replace the package name here as well, referenced as applicationId

Try to build (a clean may also be required) your SmartExtension sample module to see whether everything seem to be in the right places and don’t contain errors. I got some minor issues with imports to “com.sample….R” that had not been cleaned out. Deleting those manually worked out perfectly fine for me.

Modifying the gradle files to update references and build configs

To lay the last stones in the process, you will need to do some additional updates to gradle files, both the SmartExtension sample and the Wear app.

NOTE! These steps require you to have an Android keystore and the secrets that go with them:

  1. Open the Wear app gradle build file
  2. Add the signingConfigs declaration and reference as shown below:
android {
  signingConfigs {
    release {
      keyAlias 'YOUR_KEY_ALIAS'
      keyPassword 'YOUR_KEY_PASSWORD'
      storeFile file('PATH_TO_YOUR_KEYSTORE_FILE')
      storePassword 'YOUR_KEYSTORE_PASSWORD'
  buildTypes {
    release {
      signingConfig signingConfigs.release
  1. Open the SmartExtension sample gradle build file
  2. Add the same declarations and references as in step 2 above, but also include the following (replace ‘:app’ with the module name of your Wear module):
dependencies {
  wearApp project(':app')

Step 4: Configure the Build Variants

This is the last step before making the final build. Find the “Build Variants” panel in Android Studio (it’s usually located at the bottom left of the UI) and select release for the Wear app and the SmartExtension sample. Leave “SmartExtensionUtils” and “SmartExtensionAPI” on debug.

Select the SmartExtension sample as your build configuration, compile, run and deploy! (If the “Edit configuration” dialogue shows up, choose to not launch an Activity, as the sample does not have a Default one declared)

Step 5. Done!

Congratulations! You should now, given nothing breaks down on you, have a SmartWatch 2 and 3 combined Android Studio project!

Musings about going from Eclipse to Android Studio 0.3.7

So, the first time around when Android Studio was announced I was pretty excited. Seeing that something tightly connected to Android in the shape of a Google pushed IDE, well that should bring a lot of nice things!
But alas, after a few hours of tinkering and trying to import projects exported from Eclipse by following the it’s-supposed-to-be-this-easy guides, I gave up. Too many issues with importing my projects and also, not having really used IntelliJ and even less Gradle, it was just too many issues at hand to keep track of that I chose to postpone.
So, here we are, version 0.3.7 later and I must say it seems a lot more straight forward (in most cases).

¤ One thing that I really have to stress is Android Studios way of not helping out how to import projects based on bare Android source code. The guides talk a whole lot about Maven and Gradle, but it took me actually testing out an import where I ignored all those keywords and reading the IntelliJ documentation on importing code, to be able to deduce that yes, it is possible to import bare Android code.
Really, this should have been much more clearly stated/supported because now, there is no clear way at all whether this kind of import is supported or not.

¤ Another thing. In Eclipse it was possible to mark projects as libraries and then chain the dependencies in a way that your project can reference a library that in turn references another library. With Android Studio it seems that your project has to refer to all the libraries it needs, in effect not being able to chain the dependencies.

¤ Oh, a third thing. It seems like the terminology “project” in Android Studio is an umbrella for keeping track of one or more “modules”. The Eclipse “projects” seem to map to “modules” in Android Studio and I guess Android Studios “projects” are most likely “workspaces” in Eclipse.

My impressions on two not-that-old mobile OSes (Ubuntu Touch et. Firefox OS)

I had the good fortune of getting a “Firefox OS Developer Preview” device called “peak” delivered to me the other day. It took nearly a month from purchase to delivery and the overall information sharing by Geeksphone (the creators of peak) was not what I would expect. But I digress. We’re here to talk about the devices, or rather the OS on the devices. There already is an insane amount of videos and specs and whatnot on the interweb but I’d like to do my own writeup of these things, if you don’t mind.

Mix it

Alongside peak I decided to take a swing at Ubuntu Touch. Considering I already have a plethora of Nexus devices I wanted to choose one of them that wasn’t being used as my daily driver, which made the choice fall on the Samsung Galaxy Nexus. There was no real other reasoning behind this other than that I needed my N7 and N4 to stay in the shape they’re currently at but down the line I’ll test Touch out on those as well to see what kind of difference that makes.

To the summit

So, starting off with peak. This device gave me mixed feelings from the first get go when I took it out of its packaging (which is a pretty nice and interesting piece made out of recycled cardboard (I imagine)): It is plasticy, it has a weird “neck” at the top where the camera housing is located (sort of an inverse “neck” that the Galaxy Nexus has) and it has a somewhat iPhone’y look (bottom-middle-placed-home-button-and-nothing-more).

Booting the thing was a blast from the past when I saw the boot logo appear in all it’s 256 colour splendour. Everything after that has at least some 64K colours (probably even 16M but I haven’t verified). Booting was fairly quick, I didn’t have time to think any of it.

Lock/App screens
Having used a build of Firefox OS on a Samsung Galaxy S, I at least knew how to work with the lock screen. Being so used to swiping left or right or basically any direction from other devices (all the Nexi), double tapping the unlock symbol feels a bit awkward.

The homescreen layout and feel is, too me, more reminiscent of iPhone, apart from the one big clock “widget” (which I’m guessing can’t be switched out by something else in this version) at the top on the first screen.
Swiping to the left brings up two new screens. The first screen being a small set of tools such as camera, fm radio, settings, etc. Another swipe to the left brings up another small set of tools such as calendar, clock, e-mail, etc.
Swiping to the right from the homescreen brings up another iPhone-similar screen, which consists of a search field at the top and a collection of grouped circular app icons divided in categories such as social, weather, sports, etc. Tapping the search field and typing in letters quickfilters a result of apps that you have installed. This, which was a bit disappointing, didn’t search on the Marketplace (which is an app where you can go look for more apps!). That would’ve been a nice to have.
Moving about the screens works fine, however one thing that ticks me off: When I tap an app icon, sometimes the device registers this as a swipe. The first thought that came to my mind was “Oh, ok. So I nudged my finger a bit sideways, I’ll try it aga… hmmm, it happened again. And I swear I didn’t nudge my finger in any direction this time.”. This becomes a bit annoying after a while. I’ll take a look at the code at some point to see if I can Fix-It[tm].

Home lock screen

Home lock screen (found no way of hiding the toast...)

Home screen

Home screen

App screen 1

App screen 1

Finder screen

Finder screen

Looking at the apps, I took a dive into the Settings. It looks rather nice with clear icons (I haven’t figured out what the “Internet sharing” icon should look like, though… Some kind of chain links..?) and toggles (which are non-swipable). Tapping a setting, opens up the setting page for that setting…. and with that an almost impossible-to-hit-back-button in the upper left corner! I don’t know why this decision was made, but that’s what you get. I’ll see if I can Fix-That-As-Well[tm] later. I changed a few settings such as volumes and enabled lockscreen unlock sounds. One thing I noticed. THE UNLOCK SOUND IS REALLY LOUD! AND THE PHONE DIALLER SOUND AS WELL! And there’s no way to adjust the volumes for those. One thing that I found to be pleasing in all this cacophony of noise is that the external speaker really packs quite a punch.
Taking a look at the Browser, to me one of the integral parts of Firefox OS, it feels ok. Address bar at the top, alongside a sidebar-opener-button on the right hand side. At the bottom there appears a number of context sensitive navigation buttons. The browsing experience is ok, pages load fairly quick (running traffic over 3G) but, and this I don’t know why: More or less half of the times I would get greeted with a “Problem loading page” message. When this occured, each time I tried accessing a page, I could see the data traffic notifier icon animate a couple of times and then disappear as if nothing worked. I had to reboot the device whenever this happened. The Marketplace app was giving me a tough time. Half of the times nothing happened when I tapped the app buttons on the front page (featured apps I guess) after it had loaded, the other half of the times when I could tap (for instance) a category, nothing happened when I tapped an app button within the category, and lastly the third half of the times the data connection actually broke when navigating in the Marketplace so I had to reboot. All in all, a pretty horrible experience and I didn’t get to install any apps! Testing the HERE Maps app was interesting. It worked quite well, tiles loaded as they should, it found my GPS based location, I couldn’t figure out how to turn GPS off (or at least I couldn’t make the notification icon disappear. It changed color from white to gray, but never disappeared no matter what I did to settings or running apps). Also, the HERE Maps UI is really created for another screen density. Even tinier buttons than the back button in the settings mentioned earlier.

Settings page

Settings page with an infinitely small back button!

Broken Marketplace

Most of the times the Marketplace looked like this...

HERE maps

tiiiny buttons (HERE maps)

Ok, the experience so far has been rough. I do however understand that there is a reason it says “Developer Preview” all over this thing (well, it’s only stated at the back actually. But it’s clearly visible. No beating around the bush.). Over time when the software gets more mature, the device will follow along with it (here’s hoping that intermittent data connection drops requiring reboots will be a thing of the past (I’ll-See-If-I-Can-Get-Around-To-Fix-That-As-Well[tm])).
What I do sincerely like is the fact that this is supposed to be a truly Internet-centered OS and I absolutely believe that. What will be interesting is to see whether the populace of smartphone users and all the devs are ready, willing and mature to embrace it in order to make it _really_ usable. I’ll certainly try and be all of those and keep monitoring the situation while I spend my time adapting my web services to it.

[Adjective] [Animal]

Well, not really. Ubuntu Touch doesn’t really have that familiar naming that is connected to Ubuntu releases. I’m sure it will in the future though.

Getting a hold of a build and flashing this was a whole lot easier than I thought. One light pound of Galaxy Nexus, one ounce of Lubuntu, three pinches of apt-get and a hint of command lining and the thing was baked and ready to eat! No manual flashing of binaries in the correct order and right versions, it just worked[tm].

Booting up Ubuntu caught my interest in the fact that the only thing telling you that you are actually booting anything is the usual short vibration when pressing the power button and the Google logo… then everything goes black… and then you’re in Ubuntu Touch! For those of you who are used to later versions of Ubuntu, you will recognize the orange-purple colour scheme. Which I totally dig.

Lock/App screens
It’s really nice to rest your eyes on and the homelockscreen (in lack of a better word) is nice to look at. It displays a status bar with a bunch of icons, a digital clock at the top, a circular clock like widget with the text “14 tweets received” printed in it and a small marker working as a visual queue for the 14 tweets that “I” have received. Ok, that’s all nice but the question is though, how do I “unlock” this so I can start poking around? Tapping the “14 tweets received widget”? Pulling down the status bar? Swiping the “14 tweets received” widget?…. Apparently not. Ok, so let’s swipe and tap pretty much everywh… AHA! Swiping left from the rightmost edge was the trick! Nothing like a small moment of frustration on the first trial of a new OS.

So, now I’m at the Home screen (which is aptly named just that). It consists of a few Frequent apps such as Camera (that works), Phone (which doesn’t work), Browser, etc. Further down there is an area called Favourite People with a few happy people displayed on “cards”. Scrolling down we find People Recently in Touch, which I guess is who “I” contacted lately. Even further down we find Recent Music. Going down, here is Videos Popular Online. Scrolling a bit fu… No, wait. It stops there.
Naturally, as a smartphone user, I start swiping to the right and left and find a few more screens. The first swipe to the left reveals Apps (and also a bottom bar which pans in from the bottom of the screen, displaying which screen I’m at, represented by an icon), which displays a collection of Running apps. Below that is the previously mentioned Frequently used collection of apps and below that we find Installed and at last a collection called Available for Download. Swiping left yet again here is a Videos screen. At the top: Featured, below that: Recent, further down: New Releases, scrolling more: Popular Online. This is the end of the screens in this direction. Swiping right from Home reveals a People screen. This is in all essentiality “my” address book on a scrollable screen. Yet another swipe to the right displays Music. The content is laid out in much the same way as Videos so I won’t go through it once more. (After all, you have read 1774 words so far, and that’s not a small amount).



Running apps

Running apps

Navigator indicator

Navigator indicator

Status bar
Swiping the status bar was really awkward. I of course, being that naive, expected an Android kind of information curtain display. And it actually is pretty Android’y, but with the big difference that it’s aware of what status icon you swiped over and displays contents based on that. So swiping the finger down over the blue letter, I get the messages that I’ve been missing out. Swiping over the speaker icon displays audio settings. Nice touch (pun intended?)!

Messages pulldown

Messages pulldown

*Swipe* *swipe* *swipe*
So a bit of swiping later I’ve realised two things: 1: It’s really hard to do repeatable swipes and access what you would expect. 2: See 1. The reason for this is that more or less everything is swipeable and yields different results. More often than not I would actually start to swipe a bit too far to the right or left of the screen which would not switch between the home screens (or any other paged view) but instead either 1: bring up the quicklaunch sidebar for a brief half a second and then bring me back to one of the home screens or 2: switch between already running apps. These are neat features but they’re in the current state of things more a nuisance than of assistance.
Oh, another thing. I found a sort of Google Now equivalent. When in an app, you can swipe upwards which reveals a semi-transparent icon with a looking glass. Releasing the finger over it brings up a field (and a few buttons) that says “Type or say a command”. I tried to type “message” but it didn’t do anything.

Quicklaunch sidebar

Quicklaunch sidebar

Find it

"Ubuntu Now" spyglass icon

While poking around the different apps I found another hidden gem, so to speak. Opening the Phone app gives you pretty much what you would expect: somewhere to tap in a number and then a button to place the call. However, looking at the top of the app there is something that tells the tale of more under the surface. The title of the app is “Call >” and I just tested out tapping the text and what do you know, there are more options revealed! So in the Phone app you will now have the different scrollable “tabs” Call, Conversations and Contacts. When you have selected a tab, the other options will fade into the background and reappear if you swipe or tap the title again. Neat! There are a couple of more apps bundled in this software, however, either they require signing in or they aren’t functional and just work as placeholders.

Displaying scrollable tabs

Displaying scrollable tabs

Remember when I mentioned the first trial of a new OS. When I say that this is an OS, you may believe that this is something that can be used, perhaps not as a daily driver but at least to some extent for mail and some basic messaging, maybe some music entertainment. But you know what, I wouldn’t recommend it. This is, in my opinion, something that you are going to use as a way of trying to understand what the Ubuntu creators are up to in the mobile scene. One of the very telling tales of this is that there is a pre-installed, pre-populated account. There are a whole bunch of fake friends, fake messages, fake videos, fake music, and so on. I have found no way of switching users. I was able to create a user (with a bit of adb and ssh keyboarding) but nowhere did I find a Log out or Switch account-button.
Also, the screen won’t turn off automatically. Ok, so this isn’t really a usability thing but it’s still one of those things that are pretty vital if you don’t want a dead weight in your pocket because you accidently hit the power button.

The end

Ok, so where does this leave us? Well, these OSes don’t really have a lot in common other than being run on mobile devices and having Android as their common denominator. Firefox OS is focusing in on a lightweight system which primarily make use of different kinds of web technologies to make itself usable. And seeing the explosive nature of Internet services and availability, I’m pretty confident that this will find its place. Especially considering that adaptation of an already existing web service should prove not to be too high of an effort.
Ubuntu Touch is instead going in the direction of becoming your ubiquitous-carry-around-mini-format-computer OS. This in itself opens up another set of possibilities (I would love to see the day when I can have a docking station at home and at work that are hooked up to a screen, keyboard and mouse and the UI  seamlessly switches between desktop and mobile depending on whether the device is in the dock or not) but also challenges in the shape of app making.

Ok, so this was my take on Firefox OS and Ubuntu Touch at this point in time. For those of you interested in more developie or tekkie reading material, you’ll have to wait a while longer until I’ve started to get around to keyboarding out a few samples. These thing take time, mind you. Why not do a little bit of searching on the Interwebs while you wait?

Windows 7 64-bit + Java jre 7 != Körbar Android SDK Manager

Satt och klurade lite på varför Android SDK Managern vägrade starta. Lite ostrukturerat googlande gav tills lut denna StackOverflow-frågan:

Kortfattat: Det kan finnas flera java.exe-binärer som innebär att fel binär kopplas till Android SDK Managern. Om man ser till att ens PATH innehåller sökvägen till mappen där jre 7-java-binären ligger, samt att sökvägen finns _innan_ sökvägen till \windows\system32, så borde det lösa sig. Ta gärna och kolla vad kommandot “where java” spottar ur sig.

Eclipse, Android, installation och “must override a superclass method”

Det här är ett mycket irriterande och rätt svårlöst problem eftersom kompileringsfelmeddelandet man får är ohyggligt otydligt när man väl kommer fram till varför det uppstår.

Du har
* Windows XP (32 bitar)

och vill installera
* Java
* Eclipse
* Android SDK

Så, du laddar hem det som krävs och kör installationerna av det hela. Du sätter igång ett nytt Android-projekt och implementerar ett interface. Du vet att det krävs ett par obligatoriska metoder pga din implementation och gör @Override-implementationer av metoder. Här lägger du nu märke till ett problem. Kompilatorn säger

The method createNdefMessage(NfcEvent) of type MainActivity must override a superclass method

Du undrar vad i hela friden det här innebär, flänger runt i lite olika API:er för att se om det verkligen är rätt stavat och har rätt antal argument men hittar inget direkt uppenbart fel. Så då börjar googlandet och till slut kommer du fram till att

Eclipse väljer ut en lägre kompileringsversion än den som krävs. Ofta väljs 1.5 ut som standard och för att det ska bli någorlunda ordning och reda behöver man 1.6.

Så, även om jag med största sannolikhet kommer att glömma bort att jag skrivit om detta (för det är inte alltför ofta det här problemet uppstår) så tänker jag att både jag själv och någon annan skulle kunna ha nytta av det förr eller senare.

Cygwin och “My documents” i Windows-nätverk

Stötte på ett intressant fenomen när jag försökte få ihop min datormiljö på jobbet. Två datorer har jag, en Ubuntu och en Windows XP. Båda sitter på samma nät och monterar en enhet (Ubuntu) och Mina Dokument (Windows) vid inloggning. Att symlänka enheten i Ubuntu var en barnlek, men på Windows blev det värre. Eftersom Mina Dokument-mappen är en monterad mapp från nätverket blev det inte riktigt rätt att i Cygwin skriva

cd /cygdrive/c/Documents\ and\ Settings/[min användare]/My\ Documents

Däremot lyckades jag ta reda på var någonstans mappen hörde hemma och med lite trial-and-error lyckades jag luska ut att följande fungerar:

cd '\\[Server]\[Share}\[Folder]'

Detta kan man ju sedan med fördel använda för att skapa symlänk av.

Avgör om du kör 32 eller 64 bitars *buntu

Satt på jobbet och försökte ta reda på hur man tar fram om man kör 32 eller 64 bitars Ubuntu. En snabb sökning senare avslöjade kommandot

file /sbin/init


Jag har länge avskytt hårdvarutillverkares taffliga försök att skaka fram mjukvara för datorer (främst Windows) där de vill att man som användare ska ha en “svit” för att göra de vanligaste sakerna man brukar göra med sin enhet kopplad till datorn. Ofta blir det att den här mjukvaran antingen är för funktionsfattig, för stor (60MB+ är ju inga ovanligheter), icke-fungerande eller rätt och slätt ful (högst subjektivt).

Det som stör mig allra mest är när de också har mage att tvinga en att installera den här sviten för att tillåta något så enkelt och basalt som en drivrutinsinstallation för enheten. Jag har som tur är aldrig än så länge tvingats installera en sådan svit, utan har efter mycket sökmotorande och forumläsande, lyckats få tag på drivrutiner när jag behövt. Om jag någon dag tvingas använda en svit för en kommande enhet kommer jag förmodligen inte att behålla enheten utan se mig om efter en annan.

Jag har med hjälp av Ascii på Swedroid lyckats få tag på ett drivrutinspaket för Android-enheter som är rätt komplett och förhållandevis enkelt att hantera, om man bara är ute efter att bara installera just drivrutiner i Windows. Jag är en Android-utvecklare och har inget behov av några extra krussiduller förutom just drivrutiner och jag tror det finns fler som har samma behov.

Därför beskriver jag här vad paketet innehåller (i mer och mer detalj allteftersom jag har tid att uppdatera detta inlägg) och en länk till var man kan ladda ner det. Det ligger på min Google Drive, fritt tillgängligt att ladda ner för den som behöver.


Android-drivrutiner (Google Drive)


Jag har inte gjort det här paketet själv, till att börja med, men jag använder det själv när jag behöver. Paketet är baserat på ett bibliotek från Microsoft som heter Driver Package Installer (DPInst). Det huvudsakliga syftet med DPInst är att förenkla proceduren att låta en användare installera drivrutiner och minimerar det manuella jobbet genom att göra det hela mer automatiserat.

I rooten av paketet finns det två mappar och en fil

  • Mapp: amd64 (64-bitsversioner av drivrutinerna)
  • Mapp: x86 (32-bitsversioner av drivrutinerna)
  • Fil: install-drivers.cmd (Start-fil som, baserat på om man har 32- eller 64-bits OS kör filen dpinst.exe i antingen x86- eller amd64-mappen)
(Tidsbrist gör att jag inte kommer längre pecis just nu, men ett tips på vägen)

Google Nexus-enheter

Jag rekommenderar att du, om du har en Nexus-enhet, installerar drivrutinerna på egen hand och inte förlitar dig på automatiseringen i detta paket. Detta för att du har full kontroll på händelseförloppet och att du dessutom kan förklara i vilket steg det gick snett om det gick snett, så att andra kan hjälpa dig. Det finns en guide för hur man installerar dessa drivrutiner för iaf Galaxy Nexus på den här sidan av bloggen. Den kommer fungera även för andra Nexus-enheter (sånär som på Nexus 7, som jag inte har drivrutinerna till än), plus följande “vanliga” Android-enheter (+ betyder att jag själv testat dessa, – att jag själv inte testat dessa, ¤ att de ingår i basutbudet eller testats av andra):

  • ¤ HTC Dream
  • + HTC Magic
  • + HTC Desire S
  • + HTC Hero
  • + HTC Legend
  • + HTC Sensation
  • + HTC Desire
  • ¤ HTC Incredible
  • ¤ HTC Supersonic
  • + Google HTC Nexus One
  • + Google Samsung Nexus S
  • + Google Samsung Galaxy Nexus
  • ¤ Moto Sholes
  • + Huawei IDEOS
  • ¤ LGE GW620
  • ¤ Kindle Fire
  • ¤ SciPhone N19
  • ¤ NVIDIA Tegra
  • ¤ Nook E-Ink
  • ¤ B & N Nook Color

setTag, getTag sitting in a tree…

Jag knåpar ihop en app som ska hålla koll på antalet slag man gör under en Frisbeegolf-runda och ganska oundvikligt hamnade jag i arbetet med att lägga till och ta bort View:s dynamiskt. Dessutom behövde jag på något sätt sitta och klura ut hur layouten av dessa View:s skulle se ut, vilket obönhörligen gjorde att jag snabbt kom i kontakt med getTag och setTag tillsammans med LayoutParameters.

En liten kodsnippet på hur det kan se ut

TextView textScore = new TextView(this);
textScore.setText("" +currScore.getScore());
RelativeLayout.LayoutParams paramsScore = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
paramsScore.addRule(RelativeLayout.BELOW, textPlayer.getId());
row.addView(textScore, paramsScore);

Enkelt förklarat kommer denna kod att lägga till en View relativt positionerat under View:n textPlayer. Guld och gröna skogar, men vad man måste se till att hålla reda på är att setTag inte gillar att man använder id:t 0, som i setTag(0), för då kommer den View man vill positionera relativt att inte hamna just relativt till något annat än, så vitt jag kan förstå, till föräldern.

Alltså, se till att använda setTag med 1-indexering: setTag(1), setTag(2), …!

Galaxy Nexus, yakju -> yakjuxw

Jag har följt en tråd på Swedroid vilken handlar om att flasha om sin USA-flashade Galaxy Nexus-image till en mer svensknordiskeuropeisk-vänlig sådan. Detta är en guide för hur man kan återställa sin Galaxy till det originalformat man köpt den i.



  • PdaNet for Android (
  • Paul’s superboot, GSM-modellen (
  • yakjuxw-image ( Observera att detta inte är en image som publiceras av Samsung eller Google. De har med största sannolikhet kommit från användare som lyckats ta kopior av sitt yakjuxw-system som de sedan varit vänliga nog att dela med sig av. Jag har lagt upp den på mitt Mediafire-konto, om inte annat för att själv ha tillgång till den om jag skulle behöva. Kontrollera följande hashar mot de filer ni laddat ner så att ni åtminstonde har någon verifikation på dem:
[MD5 hashes]
radio:      15d6bd69920a64e4acf3279271e73648
bootloader: 3f981a8e5f91df8a7a26a7583c1f80f8
boot:       c57720964027d8afdcee4c071dde2011
system:     46e6b6cd98ccf0006d21ccce62082165
recovery:   6046d9fcf2e877ad40d6a8e77c145c65
userdata:   d003ab084270edd22483ce8f1f8b05c9


Installera PdaNet i Windows enligt alla konstens regler. Jag föreslår att man kopplar ur Galaxyn från USB:n (alternativt att man inte kopplar in den i datorn alls) innan installation av PdaNet. PdaNet innehåller drivrutiner för att kunna kommunicera med ett gäng olika telefoner över ADB och fastboot och det var det enda paket som jag fick att fungera ordentligt.

Packa upp innehållet från Paul’s superboot och yakjuxw-image i en lämplig mapp som du enkelt kan komma åt med kommandotolken/terminalen i Windows.

Utför dessa kommandon (OBS! Detta kommer att nollställa enheten totalt, så se nu till att ta BACKUP innan du kör detta)

c:\> fastboot-windows.exe flash bootloader bootloader-maguro-primela03.img
c:\> fastboot-windows.exe reboot-bootloader

//Vänta i ca 5-10 sekunder

c:\> fastboot-windows.exe flash radio radio-maguro-i9250xxla02.img
c:\> fastboot-windows.exe reboot-bootloader

//Vänta i ca 5-10 sekunder

c:\> fastboot-windows.exe flash system system.img
c:\> fastboot-windows.exe flash boot boot.img
c:\> fastboot-windows.exe flash recovery recovery.img
c:\> fastboot-windows.exe flash userdata userdata.img
c:\> fastboot-windows.exe reboot


Då var det klart! Om allting gick vägen och det inte blev några problem med något av de angivna kommandona ovan har du nu en yakjuxw-baserad image till din Galaxy Nexus. Grattis!