Tuesday, December 17, 2013

Could not download artifact 'xxx.yyy.zzz:xyz:0.0.0@jar'

I've recently got errors related to gradle not being able to find a few dependencies.
 * What went wrong:
 A problem occurred configuring project ':ExampleProject'.
 > Failed to notify project evaluation listener.
    > Could not download artifact 'com.squareup.dagger:dagger:1.2.0@jar'
       > Artifact 'com.squareup.dagger:dagger:1.2.0@jar' not found.
Solution: Use gradle's option --refresh-dependencies to force a refresh of dependencies. :)

Monday, September 30, 2013

Back stack with nested fragments + back button

When you have fragments with nested fragments, the FragmentActivity which handles the BACK button will not properly handle the back stack of those nested fragments.

In my application, I'm using a ViewPager with some fragments, and only one of them has nested fragments added to the back stack. In this case, when someone tries to press the back button, the activity will not handle the nested fragment stack and will finish right away. To solve this problem, I've implemented the following hack to the FragmentActivity. Please note that the activity only has one back stack: this will not work properly when you have a ViewPager with multiple fragments adding/replacing fragments into the back stack as it will get messy when the stack is not in a desired order.

Monday, November 26, 2012

Installing CM10 onto Galaxy Tab (SC-01C)

I've decided to upgrade my Galaxy Tab (SC-01C) from 2.3.3 to CM10 4.X.X. Here is the instructions I followed to get it installed using my mac.

Step 0. Full charge the phone's battery :)

Step 1. Download the required files:

Download Heimdall
Download CF-Root-TAB7_XX_OXA_JQ1-v3.3-CWM3RFS.zip
Download cm-10-20120730-EXPERIMENTAL-p1-cdesai.zip (build 3)
Download gapps if you want to have access to gmail and all google apps. :)

Step 2. Install Heimdall (restart required)

Step 3. Root phone and install CWM

3.1. Extract CF-Root-TAB7_XX_OXA_JQ1-v3.3-CWM3RFS.zip and then CF-Root-TAB7_XX_OXA_JQ1-v3.3-CWM3RFS.tar. You'll get the file: zImage.

3.2 Rebooting the phone in the downloading mode (Power on + volume down).

3.3 Execute the following command on your mac:   heimdall flash --kernel zImage

You've successfully rooted your SC-01C if you see the same result as the log above. :)

At this point you should see CWM and superuser app on your launcher.

Step 4. Flash CM10

4.1 Reboot phone in recovery mode (Power on + volume up)

4.2 backup!!

4.3 wipe data/factory reset,  wipe cache partition, advanced/wipe dalvik cache

4.4 install zip from sdcard: CM10 and gapps :)

*** The system might reboot into an updated CWM 6.0 recovery mode. Try to flash the zip files again.

*** Read this if you get an error with Status 7 -> http://forum.xda-developers.com/showpost.php?p=21649322&postcount=468

Step 5. Reboot system and enjoy CM10 :)



Saturday, April 21, 2012

Android two lines ListPreference (title and subtitle)

This is an extension to ListPreference to display two lines for each item. It's possible to display additional information to each entry with this. :)

Tested on Android 2.2.3-4.0.3.

Thursday, March 15, 2012

String resources with font color

To have a TextView show a string resource with colors use a "font" tag with attribute fgcolor, NOT color:

  <string name="some_text">this is <font fgcolor="#ffff0000">red</font></string>

Source: http://tumble.mlcastle.net/post/17700903735/html-like-tags-in-android-string-resources