Android Code Tips

Styled text in TextView

Posted by on 2011/07/07 at 12:30 pm

The easiest way of having styled text in a TextView is to use HTML and it is very easy to do it: mTextView.setText(Html.fromHtml(“This is a < b >bold< /b > and < i >italics< /i > styled textview!”));

FacebookGoogle BookmarksTwitterFriendFeedGoogle GmailBlogger PostGoogle ReaderHotmailWordPressShare

Android XML Code format

Posted by on 2011/07/01 at 10:27 pm

It’s been a while since I last posted something about android programming. From my point of view, this is a great thing, there is an untold story lying here! :) Working with the Android UI requires a lot of XML “syntaxing”. (I’m sorry, I do not like the use of the words “programming” or “develpment” [...]

FacebookGoogle BookmarksTwitterFriendFeedGoogle GmailBlogger PostGoogle ReaderHotmailWordPressShare

startActivityForResult and onActivityResult issue

Posted by on 2011/04/26 at 12:23 pm

The use of startActivityForResult is a very common and useful practice to do things within your application. But it suffers from a architecture issue, very rare and difficult to find out. The onActivityResult method gets called immediately after the startActivityForResult. This happens because the started activity lacks the correct launchMode which must be set to [...]

FacebookGoogle BookmarksTwitterFriendFeedGoogle GmailBlogger PostGoogle ReaderHotmailWordPressShare

Back in Android’s WebView

Posted by on 2011/04/13 at 9:11 pm

When a user navigates a website through a webview, pressing the back button will finish the current activity, instead of going back in the browsing history. You can change this behavior like this:

FacebookGoogle BookmarksTwitterFriendFeedGoogle GmailBlogger PostGoogle ReaderHotmailWordPressShare

Android change listview divider

Posted by on 2011/04/13 at 4:29 pm

Always remember, when you set a listview’s divider to a color, to set the divider height. Also known as “Why does the listview is not showing the divider”

FacebookGoogle BookmarksTwitterFriendFeedGoogle GmailBlogger PostGoogle ReaderHotmailWordPressShare