Beginner’s Android project

Objective: I’ll explain I made an Android app that does more than just print Hello World!

  • You will be able to save a list of movies that you have watched
  • Store your ratings along with IMDB/metacritic ratings
  • Get a graphical plot of how your likes correlate with the world’s

Assumption: This series assumes you know Java and have been able to make a “Hello world!” on your own

What will you be exposed to by the end?

  • Intents
  • Menus and lists
  • JSON
  • achartengine (popular charting engine)
  • Asynctasks
  • SQlist DB
  • Few best practices

Why did I make this post?

After completing the very popular course on coursera here – https://class.coursera.org/android-001, I had an inkling of what most words meant but was still clueless about was how everything melded together…why use a Listview instead of a View or a pendingintent in place of an intent

It all becomes clear once you try making something on your own, so let’s get started

STEP 1

Every screen you see on your phone is an Activity

Make a rough sketch of what you would like every screen to look like, this gives you a goal of how to design components

My app will have 4 activities

  • Main screen with 4 buttons to act as the main menu
  • A text field to entry your movie to search and a ratingbar to well…rate it along with IMDb info pulled from a webservice
  • A listactivity to list down all your saved movies with other info pulled form IMDB
  • A scatterchart showing your ratings against IMDb ratings

 STEP 2

Let’s make our main activity

Start by opening these 2 links in other tabs

Look at the layout, it is a linear layout with 4 buttons

Why linearlayout? Because we don’t need any fancy positioning, just 4 simple buttons in middle of the screen

Notice that the layout_gravity is center_horizontal and center_vertical to centralize it on the screen

Everything that we may want to reference in code should have an ID which we have done for all our buttons

Time to look at the activity

Our class extends Activity since it makes up one screen of our app

We implement View.OnclickListener because we want some action to happen when we click…you may ask what action and on what click? That is defined in the onClick method

Notice on line 14, I have defined my buttons globally. That is because the buttons could be used in many places around the class and using findViewById everywhere will be cluttery and wasteful

Why haven’t I assigned the buttons globally? Because they are not created yet…the layout gets created after setContentView along with the buttons and fields

onCreate / initialize

Initial setup of your layout using setContentView passing the layout xml

Assign your view variables using findViewById

Setting a click listener to all the buttons with setOnClickListener. When we click any of these buttons, our onClick method is called which decides what to do with it

onClick

onClick gets passed a view, in our case, it will be one of the 4 buttons we set a listener to

We use a switch/case to decide which button gets clicked and do some action

The first 2 buttons start a new activity by creating an intent, the third button gets an intent from elsewhere (explained later) and the last button uses an asynchronous task (also explained later)

The intent created takes 2 arguments, the context where ‘this’ is sufficient and the target Activity class to start

Posted in Coding, Uncategorized | Tagged , , | Leave a comment

Paragliding in Virar

Legend:
Wiki=Kiwi=Vamsi
Path=Vishnu
nom=eat

I found out about paragliding courses in Virar during monsoons last year but didn’t give it much thought until last month
I met Pinkesh on last month’s Lohgar trek who told me about his experiences with which were good
Path and iwikiwi agreed to join along with wiki coming in from Vizag

Day 1
Path and Wiki woke up when I reached their place at 6.30, ultimately reaching Virar by 9 (late by an hour)
We met Samson at his place, completed the formalities of signing the indemnity bond, weight check to decide on wings and listing out physical problems/phobias

We drove out to some barren paddy fields for our first day of ‘Ground handling training’
The main objective was to get used to the wing and learn about how to run in a straight line
Lucky us the winds were low, wouldn’t want to go floating away on the first day

Samson had 2 assistants along so everyone was under supervision
We were shown how to wear the harness and how to walk and control the glider over us

PhotobucketNice day to fly

Looked easy enough :s

The harness weighs about 10kgs and bites around the abdomen *ouch*, the glider is about 6 kgs
Starting position is to have the glider behind you, leaning forwards, arms back with brake lines and A-risers in hand
Then RUN, RUN FORREST RUN!
Path and Vamsi were wobbly piles of jelly after a couple of runs as each ‘takeoff’ is like running with a ton pulling you back
Morning session was about 2 hours long with Vishnu dozing off randomly

Returned to Samson’s place, ordered a homecooked lunch and slept till 3PM
Back out to repeat the whole thing a few more hours after which we were dropped to the station

We nommed thukpas, lamb curry and noodles at Sernyaa
I got back home around 1am

Ground Training>Trying to look machoBut about to fall over

Photobucket Photobucket Photobucket
Ground Training Wiki trying to look macho While trying hard to breathe
Photobucket Photobucket Photobucket
Others fell Rose from the ashes To fly again

Day 2
Scheduled meeting time was 7.15 and started a half hour late
Met Samson at the station with our gear
Plan was to do some winched flights in the morning to get a feel for takeoff and landing, then goto the beach and take 5 second flights running off a sandbar in the evening

Photobucket

Nothing got done today till 5PM because of high winds
Even the instructors were thrown around while trying to ground handle
We met people from the aeromodlling club who were practicing with a 3 foot big helpcopter

Vishnu still didn’t feel up to it so Vamsi and me nommed at Beatle with a boatoad of sushim sashimi and noodles

Photobucket Photobucket Photobucket
Glider check Strong winds Geared up
Photobucket Photobucket Photobucket
Aeromodelling club Fuel pump Dusk
Photobucket Photobucket Photobucket
Winched flight Warrior returns Gloats over the spoils

Day 3
Plan was similar to previous day’s
Morning was too gusty for winched flights so we did more ground handling
Evenings were calmer so time for winched flights
The jeep was used to pull us forwards and gain height for flights
I had 2 flights getting me to 50 and 100ft but not lasting more than 10 seconds
It was enough for takeoff and landing training
We got another day since day 2 was a wipeout

The three of us went all the way to Churchgate and nommed at Cafe Basilico after Vanmi chould not stop talking bout the ‘Steak’ place
Got back home at 2

Bonus day 4
Evening session only, time to fly off a hill
Reached there around 4PM and took 20 minutes to climb
Checked out the other instructors take their flights first to check wind conditions
Luckily they were stable so I suited up for my first ill-omened flight

Photobucket Photobucket Photobucket

Takeoff happened as expected, then I found I kept going to the left whatever I did
Samson was pretty concerned on the radio and kept giving instructions to keep my right brake down
The glider somehow ended up going straight but with minimal maneuverability but I was already on wrong side of the hill descending much faster than normal
Managed to safely land in a bush and gave an all-ok sign (Lucky it wasnt the super-thorny plants I had seen around the area)
Villagers from the area came to check out my crashlanding
I unclipped and started back up the hill for a 2nd run while one of the instructors would pack up my wing and bring it up

Turns out during takeoff, a cable had snagged the wing edge making the wing unbalanced :s
Vamsi had a good flight despite having a fever
My 2nd flight was great, lotsa fun, easy turns, slow descent, except the brake line detached from the handle as I was flaring for landing :s

We packed up and the paragliding course was over
Nommed at Sammy Sosa till midnight with Vishnu turning up at 10.30

Photobucket Photobucket Photobucket
Ready for takeoff Starting straferun Manta fly
Photobucket Photobucket Photobucket
Wildly careening to one side Notice the snag in the wing Finally a good flight
Posted in Travel & Adventure | Tagged , , , , , | 3 Comments

P90X – Day #1



P90X caught my eye sometime around July 2010
It is a 90 day strength and fitness programme fronted by Tony Horton
The goal:

  • In an attempt to avoid the bulky, non-flexible bodybuilder look, Horton focused more on exercise routines to bring about speed, flexibility, and balance, as well as muscle growth

P90X wikipedia entry lists the workouts and frequency
Beachbody forums is the HQ
Don’t miss the photo gallery of amazing transformations people have been through just because they didn’t give up

I listed strength and fitness as separate because they are complementary
There are muscleheads who cant run 5K without collapsing and marathon runners who probably can’t do 20 pushups

I liked this workout because nothing is left out

  • CardioX, PlyometricsX, KempoX for weight loss
  • YogaX, StretchX to stay limber
  • Ab RipperX for the oft dreamed of 6-pack, oops, I meant this
  • Strength training to build bulk or endurance as wanted

So I’ve been building basic strength over the last 4 months to be able to crawl through P90X once I start, apparently it was not close to enough :p

Today was day #1 – Back & Chest
Om started the workout with me today, wonder how long either of us will last

The volley of pushups were possible because of practice but I failed to do any unassisted pullups…sigh
2 hours have passed and I still cant lift my arms above head level
Here’s to hoping I find enough strength to do atleast one pullup next week in day #6

Plyometrics coming up tomorrow, prepare to CRYYYYYYYY

Posted in Cycling & Fitness | 2 Comments

Planning a vacation to China

I like traveling to new places and I am not the kind to say, “It’s toooo faaar, it’s tooo hottttt, it’s tooo coldddd”
Though I am guilty of cribbing “I have nooo companyyyy, boohooo”

By new places, I don’t mean places with nothing new to offer except a name
A recent example would be the Yatra package to the Andamans
The package planned to spend 5 days at Port Blair and 2 days at Havelock Island…BAD BAD MOVE
But that is a story for another post (coming soon)

Thanks to a heads-up on TE forums, I found out super-cheap promo tickets by Air Asia here – Super cheap tickets
Round trip to china for well under 10k! OMG!
Normal Mumbai-China tickets lighten the wallet by 35k-40k one-way
This chance was too good to give up but my only crib point was in the way…”I Needed Company”

So the status was:

  • The promo was available for one week
  • Travel dates would be anytime in Oct or Nov
  • Ticket cost would be 10-20k depending on trip size
  • Trip cost would be around 40k
  • Find atleast one person to come along
  • Convince that person that China would be a better opportunity than the Usual Thailand/Malaysia vacation

Repeated shout outs on FB, TE, #animestan got some response but no confirmations
Everyone refuted that they could not commit to something that far in the future…
WTF, the whole point of planning a vacation far in the future is to make sure nothing clashes with it!


8:30 PM

With only a few hours left for the deadline, I made a last attempt on FB and #animestan
FB had no responses…FB sucks
Naresh immediately confirmed he was in…Woohoo
Path confirmed in 10 minutes…double Woohoo…the Goa trio is back
Now everyone in the channel was full of josh, Verilog and Iwikiwi pondered while I planned itineraries and costs
Final cost came out to around 18k after which Veri, Wiki and one of Naresh’s friends confirmed


9:15 PM

Dates were preponed by 2 weeks because an International Trade Fair at Guangzhou was inflating hotel prices by upto 400%
Naresh mentioned that we had only around 15 minutes before deadline
EH!???
Turns out timezone calculation gave us till 9:30PM instead of midnight!
Few frantic attempts to hurry everyone along didn’t work…everyone was busy acting like girls deciding which seat number would go with their T-shirt color…meh
I ordered my set of tickets ASAP…unfortunately others were not as quick and they ended up paying about 4-5k more


11:00 PM

Whew, everyone is done with their bookings except Naresh…who doesn’t have a CC nowdays?!
I go scrounge the fridge for dinner and find a bowl of poha leftover from that morning…atleast better than Maggi and KFC

    Epilogue


The China trip is on :D

Tour plan is as follows:

  • 2 Oct – Fly or train to Bangalore and reach there by noon, take flight to Kuala Lumpur in the evening
  • 3 Oct – Land in KL at 12:10 AM and catch flight for Guangzhou at 5.30 AM
  • 8 Oct (apprx) – Take overnight train to Guilin
  • 16 Oct – Flight from Guilin to KL and land around 4PM, kill time till next afternoon
  • 17 Oct – Fly back to Bangalore and get connecting to Mumbai
  • 18 Oct – OfficNo I don’t want to think about it

    The gang

  • Me
  • Path
  • Naresh
  • Verilog
  • Iwikiwi
  • Manu

    Info about targets

Guilin – Tourist central :Wikipedia, Wikitravel, To See
Guangzhou – 3rd largest City: Wikipedia, Wikitravel

If Guangzhou turns out to be just like any other big city, we could squeeze in another place to visit in the itinerary

To do

  • Renew passport
  • Get visa to China and Malaysia…Malaysia does not have visa on arrival for India anymore :(
  • Details on Guangzhou to Guilin train
  • Accommodation
  • WOot

Posted in Travel & Adventure | 3 Comments

Foodhunter stalks Bangalore

During my last visit to Bangalore, I had time for a few meals but no idea where to begin, Burrp came to the rescue as usual

I was staying at NGV, Kormangla and was happy to find the city’s top rated restaurant a 10 minute auto ride away

Neha and me reached P!ng Restaurant at 3:00PM, about half hour before end of the afternoon shift and found it empty
It hosts an Asian centric menu like Chinese, Thai, Indonasian, Oriental
Seating is good, there is a typical indoor section, and an outdoor/covered roof seating area
According to the menu, their specialty are Dimsum’s and wine
We had a vegetarian dimsum platter which offers 6 pairs, 3 types steamed and 3 fried

Dimsum's at P!ng

This was followed by a main course of noodles and some gravy dish, don’t remember which ones now, but it was good

I would rate it a 8/10, probably because I didn’t get to try their non-veg choices (GRRR vegetarians)

DAY II

It’s Sunday afternoon and I needed lunch to replenish yesterday;s lost calories
Since I had to return the bike at Malleshwaram and I had to visit Blossom’s at Church Street, this gave us a perfect opportunity to check out the second best restaurant rated on Burrp

We reached The Egg Factory around 2:00PM
It’s a small place with about ten tables but does not feel cramped
This place would be an Eggatarian’s delight
There were simple dishes, for eggsample, a dozen versions of omlettes
Then eggxotic dishes like Eggs Florentine

The egg stuffed Pesto pasta met my high eggpectations with it’s eggsquisite creamy sauce

I wish I had ordered the Pasta :S

My Frittata was bit of a let down, felt more like a big omelette

I would rate this place a 9.5/10 for breakfast’s and 8.5/10 for lunch/dinner

Posted in Foodie Central | Tagged , , , , | 4 Comments

Bangalore Adventure Race

I guess I’m pretty lucky to have had an entertaining start to the new year to fuel this blog

I found out about BAR while idling around BikesZone and thought it was pretty interesting.
It is a one day adventure race consisting of the following:

Road biking

Trail biking

Kayaking

Bouldering

Preparations:

I reached Bangalore around midnight and stayed the night at Nefilim’s place who seemed proud of his tummy

Met Neha the next morning and headed for Pedals & Wheels to rent a bike for the event. I was given a KHS Alite 500, luckily the proper frame size was available, got the bike tuned and carried it back to NGV in an auto
Trail bike
Bought a pile of high-carb sweet munchies to survive on the next day and was back around 6pm. Since we had to be out of the house by 2am to meet Kalkat our 3rd teammate, decided to turn in. I got a good sleep but Neha was restless

Raceday:
1:00 AM: Woke up at this godforsaken hour, did the necessary, setup the bike for the last time, packed our rucksack with loads of food and drinks
2:30 AM: Handed our bike to a volunteer who was going through the same area and were picked up by Kalkat, his wife and friend who was doubling as a backup driver
3:15 AM: We reached Turahalli and saw about two dozen participants already on the spot. Filled out the paper work and got our tags
3:45 AM: Whistle blows and the 50km race has started, Kalkat pulls me along most of the way while I am huffing and puffing up every hill. I wish Mumbai had more hills we could practice on.
It was pitch black and my bottle managed to kick loose within 5 minutes of the start. Had to spend a few minutes looking for a dark bottle on a dark road in the inky blackness with my little useless torch.
Bless Kalkat’s car which acted as support vehicle and kept the roads sufficiently illuminated without which we would be riding blind.

Pitch black

7:15 AM: Reached the U-turn checkpoint, now we have to head to Manchabale Dam and the meeting point

8:00 AM: Damn, I missed the turn and am going down the trail biking path
8:15 AM: Kalkat’s car also missed the turn and is waiting to inform me of my folly. Amazing a SX4 could handle this terrain too.
8:30 AM: Finally made it to the checkpoint, lost 30 minutes because of the wrong turn. We head for the bouldering event next
9:00 AM: WTF, we had expected to be able to do some of the easy problems but found that the boulders may as well have been greased
10:00 AM: Kalkat managed to overpower some of the rocks and scored us 3 points. We also got to see Samim Rizvi in action.
10:30 AM: Neha and Kalkat head to the kayaking event while I take a nap behind the tent
11:40 AM: The 12k trail bike event starts. I go out thinking that it meant a few bad roads. Turns out to be a sufferfest with me having to carry the bike a third of the ride on terrain I would think twice before trekking
The terrain is similar to the pic linked above, loose pebbles, rocks and slate, dust and muddy streams crisscross the track. Imagine riding this slope if the nice smooth road wasn’t in the middle

I consider myself either l33t or very lucky not to have taken a fall throughout the ride which would easily have left bloodied limbs
Made a good choice of deciding to walk across a particularly muddy stream instead of biking across. I would have made a faceplant in mud otherwise not unlike this poor chap

1:15 PM: Finally returned after getting lost once only to find everyone is waiting for me to get started on the return 40km trip
1:30 PM: I retire and get the bike loaded on the car which rest of the groups start their climb up the dam and back to Turahalli
3:00 PM: Reach Turahalli, pick up Katkat who posted a very good time
5:00 PM: Back home finally

Exhausting day but a very fun day
Next year is gonna be another attempt with me stronger, faster, better for the ‘Rising Dradon Conspiracy’ team

Loads of pics and reports here
Race reports

More race reports

Posted in Travel & Adventure | 4 Comments

Hello world!

The new year brings new resolves

This is my attempt at blogging, you should expect to feel hungry, happy, sad, confused and enraged while going through the various upcoming articles

Hello World in many programming languages
The coolest being BrainfuckLanguage

Posted in Uncategorized | 2 Comments