Friday, May 2, 2014

SecurityException (@Parcel:readException:1327) {AdWorker #1}

From my research, this bug seems to be introduced when admob was integrated into Google Play service. You would see this exception when you use r15, r16 of Google Play services.

Currently, there's no solution. But the Google Team is aimming to fix this in r17.

NullPointerException (@ActionBarImplICS:getThemedContext:287) {main}

This most likely shows up when you are trying to hide the actionbar in your app's activities.

You may be using:

requestWindowFeature(Window.FEATURE_NO_TITLE);

However, you may see NullPointerException (@ActionBarImplICS:getThemedContext:287) {main} when users press the menu button in their devices. Some Android devices have the menu button as the hardware button, while Kindle Fire devices have the menu button as a software button.

To prevent the crash from happening, you can override the menu button key code to do nothing:

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
   if ( keyCode == KeyEvent.KEYCODE_MENU ) {
       // do nothing
       return true;
   }
   return super.onKeyDown(keyCode, event);
}

Wednesday, April 23, 2014

Android Strikethrough HTML not rendering in EditText

I was working on supporting strikethrough in EditText of my app. Using StrikethroughSpan, I was able to show it in the EditText element. This strikethrough is converted to <strike></strike> when you use the toHtml() method.

However, when I try to render the strikethrough back to the EditText, I found the Html.fromHtml method does not support strikethough.

The only way to render the strikethough seems to be through the Webview. 

Saturday, February 8, 2014

StudyFlashcard 3.0 - Mobile Flashcards For Android

During the past month, I worked on a new version of StudyFlashcard For Android.

StudyFlashcard 3.0 is a mobile flashcards application for students to learn foreign languages, review exam materials, or simply as a memorization tool.
Here is the UI of the application:

















StudyFlashcard Android is different from other flashcard applications in the following ways:
1) Organize flashcards with #hashtags

Powerful #hashtag system lets you add flashcards to your midterms, exams, favorite lists, or secret lists. Study in whatever ways you imagine.
2) Study multiple subjects at once with Merge Play

Whether you have three exams on the same day or you are just bored of studying one subject for too long, Merge Play lets you study multiple flashcard sets together.
3) Study multiple questions at once with Cram Mode (Web only)

Cram mode offers a multi-column view that lets you study a lot of questions at once. This is perfect for a quick memory refresh before exams.
4) Perfect for learning vocabularies and foreign languages with three sided flashcards

Each StudyFlashcard has three sides: question, answer, and hint. Three-sided 
flashcards are perfect for learning Asian languages such as Chinese and Japanese.

Full list of features:

• Sync Flashcards with StudyFlashcard.com
• Score tracking
• hashtags
• play multiple sets of flashcards/quizzes at the same time
• Sign up is not necessary
• Works completely offline (You can create flashcards offline)
• Three sided flashcards/quizzes with question, answer and hint
• Can adjust text size

Give StudyFlashcard Android a try. Let us know what you think.

Saturday, October 12, 2013

Android - Connecting to SQLite through adb

This will only work for the Android emulator or a rooted phone. In unrooted/unlocked phones, the data files are locked.

cd into your platform-tools directory in your terminal
cd C:\Program Files (x86)\Android\android-sdk\platform-tools
Start the emulator and check if adb can detect the emulator
adb devices
Start Shell
adb shell
Connect to sqlite
sqlite3 /data/data/{your_package_name}/databases/{your_db}

Thursday, December 27, 2012

Use CellObject to browse Android SQLite data contents

This will only work with Android emulators or rooted phones.


Extract it. Find net.cellobject.sqlitexmlbrowser_1.2.0.jar.

Put net.cellobject.sqlitexmlbrowser_1.2.0.jar into the eclipce plugin directory.

Restart Eclipse.

Start the emulator.

Go to DDMS

Select your device on the left panel.

Then on the right side panel, navigate to 
data/data/{your_app_package_namespace}/databases/{app_name}
Click the database icon on the top bar of this right side panel.

You should now be able to see the table schema and browse the data in the CellObject SQLite Browser.

Sunday, December 16, 2012

Android selector needs drawable instead of just background


The following will result in a crash saying that cannot inflate the drawable.
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
  <item android:state_pressed="true" android:background="#000000" />
  <item android:state_focused="true" android:background="#000000" />
  <item android:background="#FFFFFF" />
</selector>

The solution is to change the background to use drawable

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
  <item android:state_pressed="true" android:drawable="@color/grey" />
  <item android:state_focused="true" android:drawable="@color/grey" />
  <item android:drawable="@color/white" />
</selector>

android:drawable attribute does not accept raw color.

Define color.xml in res/values.

<?xml version="1.0" encoding="utf-8"?>
<resources>
     <color name="black">#000</color>
     <color name="white">#fff</color>
     <color name="grey">#cccccc</color>
</resources>