Android: Reading, using and working with XML data and web services in Android

Posted July 19th @ 8:37 pm by Boyan Tsolov

One of the most powerful aspects of any mobile application for a 3G phone is that it can connect to the Internet. By connecting to the Internet the application can offer much more value to the user since it becomes an interface for a web-based component, e.g. using Twitter’s API to create a Twitter application so that you can get your Twitter updates without having to open the mobile browser. The most common way of interfacing with a web-based component is by using web services in XML format.

While trying to developer my own app which reads a web service from my own server, I ran into a lot of difficulties in implementing the client that consumes the web service. Android does not have libraries for XPath handling of XML documents, so it makes deciphering XML data a little bit more difficult. From what I’ve read online the Android team is currently working on including such libraries in future versions.

After some digging around I found an amazing link that shows different methods for consuming an XML file in Android and parsing through it without the use of XPaths. The link is this: Working with XML on Android. To start off, this link is an absolute must-read. Everything that I am going to write in my post here relates to this link. The code offered on that webpage uses polymorphism to show you 4 different methods of working with XML data. It provides a fully-functional Android application and all the source code for it. The source code can be found here:

My post today will concentrate on how to customize the code from the application in the above link, in order to read and parse your own XML data. If you are a Java pro, you might not need this post. My Java is a little rusty, so I needed some time to figure out exactly what I had to change and where in order to get this to work with my own web service XML. Now that I’ve figured it out, I thought I’d share it. In my next post I will give the simplified version of this code – where there is no polymorphism, and thus there are only the minimum number of classes needed to implement this XML-reading solution. I can’t offer this simplified code right now – because I haven’t coded it yet :).

So until I post the simplified source code for working with XML data in Android, here are some tips on getting through the larger polymorphism-based source code and customizing it for your own XML data:

Read the rest of this entry »


Android: Creating TableRow rows inside a TableLayout programatically

Posted July 1st @ 10:07 pm by Boyan Tsolov

In my quest to create a “Taxman” Android application I ran into the following problem:

I want to ask the user to enter their yearly income, after which the screen will flip and their after-tax income will be displayed in a table format for all Canadian provinces. (And for the future: all US states). The problem I ran into is creating a TableRow for each Canadian province in my main.xml. There are 13 provinces and territories, so 13 is not that bad to copy & paste in the main.xml; however, as soon as I have to copy & paste more than 2 times I start cringing and nausea kicks in. Personally I think “copy & paste” should not be in the programming vocabulary. Not only that, but I have 13 provinces now, what about when I have to enter 50 states! So, I had to find a way to create these new TableRow rows programmatically inside my TableLayout layout.

A great source for code snippets and answers to Android questions is I’m sure if you’re dabbling with Android then you’ve already come across this site. The particular post I read to do this is this one: Dynamically add rows to TableLayout. Commenters on that post were having problems getting this to work, but after I imported all the correct classes (android.widget.TableRow.LayoutParams is an important one to use) everything worked from the first time. I forced Eclipse to find most of the classes for me.

Below is the code from, with my changes for my Taxman Android app. I’m too lazy to do a full-out beginning-to-end tutorial for this code snippet.

First I set my constants at the top of the Activity class:

public class Activity1 extends Activity implements OnTouchListener{

    int PROVINCE_Alberta = 0;
    int PROVINCE_BC = 1;
    int PROVINCE_Manitoba = 2;
    int PROVINCE_NewBrunswick = 3;
    int PROVINCE_Newfoundland = 4;
    int PROVINCE_Northwest = 5;
    int PROVINCE_NovaScotia = 6;
    int PROVINCE_Nunavut = 7;
    int PROVINCE_Ontario = 8;
    int PROVINCE_PEI = 9;
    int PROVINCE_Quebec = 10;
    int PROVINCE_Saskatchewan = 11;
    int PROVINCE_Yukon = 12;

    int numProvinces = 13;

Read the rest of this entry »

Android: Switching screens by dragging over the touch screen

Posted May 29th @ 12:17 am by Boyan Tsolov

In this post I will show you how to use the touch screen so that you can drag your finger across the screen, and it will switch the screen for you – “iPhone style”!

For this I will be implemented OnTouchListener and overrided the method OnTouch().

To start off, we need to create an Activity with two screens. The two screens will be implemented using a ViewFlipper in the main.xml layout file. Follow the steps in this blog post to set yourself up: Android: Switching screens in an Activity with animations (using ViewFlipper).

1. Now that you have yourself set up, open the Activity1 class.

2. Make the class implement OnTouchListener. The top of the class will look like this:

import android.view.View.OnTouchListener;

public class Activity1 extends Activity implements OnTouchListener{

2. You will have to override the OnTouch() method as well. If you were using eclipse, it might have created the method stub for you:

    public boolean onTouch(View arg0, MotionEvent arg1) {
        // TODO Auto-generated method stub
        return false;

Here is the method that you need to use instead:

    public boolean onTouch(View arg0, MotionEvent arg1) {

        // Get the action that was done on this touch event
        switch (arg1.getAction())
            case MotionEvent.ACTION_DOWN:
                // store the X value when the user's finger was pressed down
                downXValue = arg1.getX();

            case MotionEvent.ACTION_UP:
                // Get the X value when the user released his/her finger
                float currentX = arg1.getX();            

                // going backwards: pushing stuff to the right
                if (downXValue < currentX)
                    // Get a reference to the ViewFlipper
                     ViewFlipper vf = (ViewFlipper) findViewById(;
                     // Set the animation
                      vf.setAnimation(AnimationUtils.loadAnimation(this, R.anim.push_left_out));
                      // Flip!

                // going forwards: pushing stuff to the left
                if (downXValue > currentX)
                    // Get a reference to the ViewFlipper
                    ViewFlipper vf = (ViewFlipper) findViewById(;
                     // Set the animation
                     vf.setInAnimation(AnimationUtils.loadAnimation(this, R.anim.push_left_in));
                      // Flip!

        // if you return false, these actions will not be recorded
        return true;

What I’ve done is added a CASE statement. On press down of the finger we save the current X value. On press up of the finger, after the dragging motion has finished, I check the X value again. I compare the two X values and I make a logical decision whether I should switch the screens forwards or backwards.

Read the rest of this entry »

Android: Switching screens in an Activity with animations (using ViewFlipper)

Posted May 26th @ 11:48 pm by Boyan Tsolov

In this post I’ll show you how to add animations when trying to switch between screens. Usually when you switch between screens it’s a direct “poof” and the new screen appears in a very un-graceful way. The SDK offers a bunch of easy-to-use animations, and I’ll show you how to use them here.

I tried doing animations on the opening and closing of activities, but I haven’t figured that out yet fully. So instead, I will show you how to use animations when switching on objects/layers inside the same activity. It will still look like you are switching screens, but all the layout data will be in one single XML. If we were to switch between activities, each activity would have had (usually) its own layout XML.

And in the post coming after this one, I’ll show you how to start this animation and switch the screen while dragging your fingers on the touch screen. Let me be a little more precise: while dragging one finger on the touch screen. I’m not sure if the OS handles multi-touch right now – or if that’s something the device has to enable – or both.

Back to the topic: how to switch between layers using animations to make it look like you are changing screens… we will be using a ViewFlipper widget in the layout XML.

1. Create a new Android project, unless you already have one

01 new project

2. Create a new Activity class that extends

02 new class

Read the rest of this entry »

Android: Reading Logs and Exceptions

Posted May 24th @ 11:21 pm by Boyan Tsolov

While developing my Android apps I routinely, regularly, almost every time, without a miss, get some kind of exception. And the error you see on screen is not developer friendly, though it is very end-user friendly:

01 error

WTF? Why? What did I do wrong this time, again?

Read the rest of this entry »

Android: How to switch between Activities

Posted May 24th @ 10:38 pm by Boyan Tsolov

In my great expectations of Google Android coming to Canada on June 2nd, I’ve started experimenting with developing some apps for the Android platform. My first app is called “The Taxman” and will calculate the amount of tax you owe per year in your province/state – well only Canada for now.

I had trouble adjusting to what an “Activity” was and how to handle it. Here is a quick and dirty way to create an Activity, and to switch to another Activity (think of it as another screen) on the click of a button.

1. Create a new Android project – or you might already have one created.

01 new project

2. Add a new Class that extends You need a total of two classes that extend Activity. You will switch from one Activity to another.

02 new class

03 new class 2

Read the rest of this entry »

Developer’s Perspective on Android: Getting Started

Posted May 24th @ 9:49 pm by Boyan Tsolov

Google Android

I’ve been a fan of Google’s mobile operating system Android for quite a while – technically since I heard about it 2 years ago. I’ve been unfortunate to live in Canada, because none of the telco companies here have carried any phones with Android (only HTC phones for now, but Samsung seems to be coming out with something soon).

But, on June 2nd 2009 Rogers is coming out with the HTC Dream and the HTC Magic and Google Android will be here! And on June 3rd Google Android will be in my hands. [I’m not going to be a geek and get it on the very first day it comes out, come on!]

So, in expectation of this date, I started playing around with Android and developing my own applications. To start off, it’s been absolutely easy, pleasant, and a breeze to setup. It was like stealing candy from a kid. I followed the instructions from the Android – Developers website and using Eclipse as my environment I was creating mobile applications in less than 30 mins.

To get the SDK follow this link:
To read the installation instructions follow this link:
And I recommend using Eclipse if you do want to get the “30 mins effect”.

I wanted to test out the different functions/features that Android offers out of the box, so I thought of a simple app which would allow me to have a goal and thus opportunities to experiment. I am going to write a “tax” application. Unfortunately, this tax application will not fill out your taxes. It will calculate how much the government has to take from you each year. You will enter your country (Canada only for now), you will enter your income, and the result will be a summary of your take-home pay and taxes due, by province (or states for the US – eventually). I’m going to call it “The Taxman”.

I’ve just started this mini app, and as I go along I will post snippets of code that I found difficult to come up with – to help out anyone that is looking for the exact same solution. Also, I have a full-time job, so it will take me a month to complete this silly app :), so my posts might be infrequent.

This weekend I had a chance to start it off and I had trouble with a couple of things. I will write a separate post on each one over the next couple of weeks. Here’s three of those things:

1. How to switch from one screen to another (also called Activities)

2. How to switch screens with an animation effect

3. How to switch screens using a dragging motion with your finger – you know, iPhone stylez.

That’s it for now… those 3 posts will be coming out very, very soon!




  • Eva longoria sex tape pictures
  • outdoor erotic teens
  • mandy moore naked gallery
  • changing toler girls video
  • free pictures of young porn
  • best home movies amateur
  • nun sex gallery
  • sex positions chair pictures
  • guys first anal butt plug
  • songs about young girls
  • fuced up porn videos
  • amateur dryhumping video
  • free black on blonde hardcore
  • car flashing video
  • group sex local
  • naked celeberty pictures
  • close up anal pics
  • incredible young tits
  • darjeeling sexy girls picture
  • wife back dick
  • black naked squirt
  • shaved celeb pussy
  • small boobs nice pussy
  • Girls having squirting orgasms
  • blonde teen reality sex
  • gagging blowjob girl trailers
  • youngest teen art
  • fresh little young teen fuck
  • Lacey duvalle sex videos
  • petite asian anal videos
  • ebony voyuer sex
  • hd free sex movies
  • old men fucking young girls porn
  • male stripper women suck movie
  • youth pics naked
  • Twilight movie sex
  • Hot first sex
  • oral sex porn tube
  • xxx amateur hall of fame
  • celebs naked pictures
  • torrent bittorrent wife sex video
  • Top teen porn sites
  • ebony glamour porn
  • you porn couples romantic
  • nude amateur gallery
  • Tight nice jeans ass
  • Gigantic black ass
  • shemale transsexual beauty queens
  • pics of hot teens fingering themselfs
  • free sex movies on tube
  • japan sex movies online
  • naked pics of debra jo rupp
  • free girls naked sex pics
  • Bubble ass parade
  • wife talk dirty video
  • chocolate movie jack black
  • asian tiny little puffy nipple girls
  • free fingering and fisting videos
  • free sex stories interracial xxx
  • babysittermovies with asian kitty
  • sexy italian girls xxx
  • hairy erotic girls thumbs
  • free porn video sarah uk
  • fuck my teen vids
  • eduion material young girls
  • wife sucking large black cocks
  • big black ebony booty
  • petite girl takes big
  • creature sex video
  • fuck my ebony pussy
  • teen amateur couples tube
  • asian teen nude thumbnails
  • sexy black animated women backgrounds
  • free peach fuzz pussy picture
  • girl rides hard porn
  • having sex in sasebo japan
  • girl pussy pictures
  • Hot sporty girl
  • yonug teenage girl
  • Models nude videos
  • asian girls swapping cum photo galleries
  • oral sex for postmenopausal women
  • spankwire chubby young teen
  • free video male orgasm
  • wrestler batista free porn movie
  • fuck my girlfriend blonde slutload
  • ashleys candy naked pictures
  • famous toon facial galleries
  • female senator butt pics
  • japanese sex doll redtube
  • girl porn live show
  • amateur plump wife videos
  • daily big tits video galleries
  • free thumbnail porn video
  • sexy chicks flash
  • porn mature ass galleries
  • kendra sex tape with girl
  • forced oral videos
  • Kappa girl sex
  • Hot indian wife sex
  • girls skirt party
  • mature couples sucking and fucking movies
  • black girl sits on dick
  • black naked ass
  • how to anal sex female
  • petite french canadian first time
  • young asian porn
  • sex play positions video
  • mature anal cumshot
  • nylon stocking teen schoolgirls
  • Sexy bare breasts
  • Hot and sexy girls of india
  • natural mature amateur thumbnail gallery
  • free girl on girl cam pics
  • painful anal teens
  • Elisha cutbert sex scene
  • just dance says lick your dick
  • Xxx girl pictures
  • no dick sex videos
  • mom boobs pics
  • Boy nude videos
  • nude chicks galleries
  • free ebony over videos
  • dbz girls having sex
  • dicks one hole porn x
  • lingerie beautiful brides wife xxx
  • bbs bikini pics
  • college girls gone wild having sex
  • womens ass galleries
  • First time masturbation
  • asian lesbians naked video
  • girls passed out naked drunk fucked
  • party hardcore streaming videos
  • bars to meet asian girls
  • dirty daughter fuck movie gallery
  • sexy asian patite shaved
  • free italian flash porn movies
  • lesbian loves fat pussy
  • year girls sex
  • tv pussy upskirt bloopers
  • frfee porn movies
  • free teeny asian porn
  • redtube teen girls
  • perfect ass anal by step brother
  • mature lesbians outside
  • Sexy girls nextdoor
  • free teen hairy pussy galleries
  • black cock no condom wife pregnant
  • Hot bhabhi sex
  • oriental hardcore movies
  • only asian pussy
  • Big boobs nude girls
  • kick ass the movie photos
  • curvy mature video x m n
  • hula girl with guitar pictures
  • fat girls with fat pussys
  • hot lesbian teens in the water
  • sexy butts tight pants
  • stories of white wives black pregnant
  • Nude wrestling movie
  • Desi couple sex video
  • girl panty poop video
  • neighbor gives handjob free video
  • nice shaved pussy
  • green eyed girls videos sex
  • williams sisters pussy
  • japanese porn masterbaiting
  • free anal milf vids
  • free porn videos of nipples
  • teens xxx video
  • young girls wiyh dicks
  • hardcore asian sex pics
  • ebony feet gallery
  • we fucked your wife video
  • dolce pussy pic
  • young sex nudist
  • watch me have sex video
  • amateur russian teen toplist
  • aimal girl sex
  • asian girl with octopus in pussy
  • black thug porn dawg pound
  • loreal frost la petite
  • Uwants online sex movie
  • free teen tranny movies
  • small young teen pics
  • teens first time fuck suck anal
  • super sluts anal videos free
  • my young pantyhose pictures
  • list of celebrity pussy slips
  • japan snake pictures
  • tiny white pussy
  • my naked sister video
  • pink thongs blonde teens
  • asian shemale dicks
  • indian girls rubbing pussy
  • picture of black widow bit
  • young olsen twin fakes hardcore
  • Huge black hairy pussy
  • wife fulfills black cock fantast
  • drunk anal sex download
  • teen hard sex van
  • girl up the butt
  • Sexy boobs movies
  • Huge tits mpeg
  • great lesbian sex sites
  • fucking young teen pictures
  • free amateur young ladyboy porn movies
  • nice young breasts
  • Sex and the city movie videos
  • rich blonde girl
  • rico strong ebony sex videos
  • foxtel black and white picture
  • best places for threesome sex vaion
  • amateur natural pics
  • free orgasm video mature
  • robert webb naked pictures
  • sexy dark black girls sucking dick
  • vagina fuck teen
  • erotic sexy hotel lake george ny
  • puberty breasts pics
  • high res hairy pussy
  • little red riding hood fuck vids
  • drunk college girl seduced by lesbian
  • nude very young nude girls young
  • ivana teen fuck
  • filipino hardcore porn
  • teen girl pivs
  • Gonorrhea from oral sex
  • channel movie sex live
  • small ass anal porn
  • wild amateur videos
  • food porn pics
  • teens free porn movies
  • round tits sex
  • how to perform lesbian sex
  • white men try black porn
  • lynett anal fuck
  • watch my fuck my girlfriend
  • Fake jennifer aniston nude pics
  • wives sex bosses
  • amateur sex threesome masturbation
  • girl geets a huge anal dick
  • free interspecies sex pictures
  • sexy real wife videos
  • hardcore porn high definition movies
  • mature women havingsex
  • hot girls with big perky boobs
  • hardcore free shemale tranny sex
  • free fooled shemale movies
  • girl bruised by dick pic
  • africa fuck sex party
  • asian girl in skirt getting fucked
  • teens sex wet clothing
  • movie electro sex pussy
  • sex with black men in pittsburgh
  • porn video alog
  • sexe anal site
  • big ass fat girls
  • Big tits private
  • free tube mature anal
  • king of queens oral sex
  • No nude teen models
  • free black nasty xxx
  • friends want to fuck my wife
  • teen girl toplees wearing briefs
  • free hot teen porn vids
  • Tight little asian pussy
  • girls wrestle cage porn
  • mature pussy passed out
  • reverse cowgirl fuck video
  • Big tit teachers
  • free ffm porn
  • bondage hardcore free video
  • sari hardcore sex
  • husband denied sex xxx
  • woman sex fantasy black men
  • very young free nude fuck pics
  • someone to fuck my wife
  • Hot naked breast
  • fucking mature women pictures
  • dirty teen girl porn
  • video garganta profunda amateur
  • hot young big girl
  • inoocent petite sweet first sex
  • girlie butts pics
  • free anal sex vidieo
  • hairy see thru lingerie pussy
  • German lesbian movie
  • tight close up pussy
  • boys humiliated by girls porn
  • pictures with a porn star
  • free hairy girls galleries
  • sexy nude girls from baltimore
  • ladies fucked anal sex
  • lightskinned black porn star
  • xxx hot mature movie thumbs
  • black tight young teen porn
  • Cute lesbian video
  • girls that can lick themselves
  • user submitted amateur pictures
  • real blonde videos
  • celeb slip ups nipple pussy
  • xxx black demon
  • tyra moore pimp my black teen
  • Hot naked girls videos
  • Beastility sex movies
  • young irish lesbian pussy
  • girl from b c bikini
  • free homemade hairy amateur porn
  • chicks dick rebecca
  • mature pretty picture
  • sexy amateur english milf
  • wives to cheat and fuck
  • henti sex video
  • Is oral sex is safe
  • liz vicious suck dick
  • videos of small tits
  • cum in pussy sleep
  • free trailer trash porn pics
  • body cumshots movies
  • mr big dicks and his chicks
  • pussy stretcher bar
  • my wife wants his dick
  • anal sex with dick
  • lesbians teens fuck each other
  • mature ametur sex
  • office girls orgasm
  • mature brunette pussy
  • hardcore porn movies for free
  • erotic mom daughter videos
  • anal sister fuck tube
  • japanese girls at spa
  • horny swedish girl video
  • ava laureen interracial porn
  • free cheerleder sex vids
  • gloria vanderbilt petite amanda cord
  • celebritie porn movies
  • teen revenge sex
  • hot pussy babes naked
  • bikini gallery teen
  • sexy tatted girls getting fucked
  • asian teen peeing
  • free sex scenes softcore sex
  • mature massage handjobs tube
  • petite cute asian
  • erotic anal cartoons
  • naked women tan lines pics only
  • black women and beauty
  • college party girl sex movies
  • s teen homevids
  • hot anal sex butt fuck
  • Kerala college girls sex
  • girls talking dirty vids
  • armpits girls gallery
  • porny naked girls
  • asian gagging on black cock
  • black lips on my dick storys
  • Big humongous boobs
  • young sex ocean
  • danielle foxx shemale movies
  • Naked play boy pics
  • Sex and sexy
  • teeny ass fuck
  • free hardcore tstv pics
  • grandma has a wet pussy
  • free porn video anal sex
  • lesbian porn australia
  • large natural breasts pics
  • freehomemade videosof young nude girls
  • flat girls galleries
  • dce college girls hostel sex videos
  • best cum on big tits movie
  • lesbian busty fuck
  • Teens bouncing boobs
  • petite teen anal tube
  • downblouse youngest teens
  • big black booty beauties
  • freepictures of hott wet naked girls
  • is anal sex safe
  • girl in girls ass
  • busty anal vids
  • big shaved pussy chicks
  • free sex stories young mature
  • xxx mature male cock suckers
  • russian girl forced to lick pussy
  • big black mature asses interracial
  • amateur online adult movies
  • interracial cheating wife whores
  • girl caught having sex
  • erotic husband wife hotel stories
  • skinny girls floppy tits
  • free streaminig japan movies
  • animated teen sex video
  • erotic video soapey massage xxx
  • Jennifer aniston nude in movie
  • mature thai girl
  • lesbian anal torrents
  • hermaphrodite sex videos on tubevideos
  • sex lesbian hentai
  • hilarious porn pictures