One night stands and Android Fragments

5:54 am

Woke up slowly.
Slowly becoming aware of the living entity beside me.

Silent sleeper?, Alright.
Legs a bit stiff. Guess they got worked out a bit.


Dire? Amanda? Aisha? Laura?
Most tribes probed into, nothing familiar.
Still not bothered.

Not a boisterous morning, at least I got what I wanted. Did she? Not too sure, not overtly bothered too.

Slow walk to the window.
Staring outside wistfully.
A few deep breaths.
Plans for the day?
The night was mildly pleasing.

Sauntered into the kitchen.
Made a cup of tea.
Black, no milk or sugar.

Make another extra cup, politeness doesn’t hurt.

Walked back into the room.
She’s awake with a somewhat distant look.
Still don’t care.

“Morning, Tea?”
“By ‘tea’, I mean black tea with nothing else.”

Engrossed in thoughts.
None of which involves her.

“I had a nice night.”

Trying to massage egos?

“Feeling is mutual.”

Distracted smile.


Surprised look.

“Errrr… Ok. I dunno. If you are cool with it. I dunno. I mean.”

Looking flustered.
Still don’t care.

“I feel hungry and I thought to ask if you didn’t mind something to eat too. Your getting flustered is cute. But as long as we understand each other, we’re cool.”

“Errrmmm. Ok.”

“Bread and Egg?”

I hate bread and egg.

“Those sound nice.”

Real smile.

“Good. Give me a few minutes.”

A little of this and that.
A trip to the fridge and breakfast is served.

“Dami, right?”

“Yes, ma’am.”
“Alright, this seems a bit awkward.”
“Breakfast? I mean, I was expecting an excuse from you to get me out of bed and on my way.”
“I don’t see the need.”
“Are you satisfied? Want more juice?”
“Yes, Sure.”

15 minutes later.
Engrossed in my emails while she idly fiddled with her phone.

Client just sent in a requirement.
Seems simple enough.
One Activity and Five fragments should handle that.

The media component might need a bit of hacking around.

“Hey, let me know when you are ready to leave. Ok? Feel free to take your time.”
“Ok. You are a weird one.”
“You are acting weird.”
“I don’t act. Too stressful.”
“Can I ask a question?”
“Do you have a girlfriend? Just curious.”
“Is this your first time?”
“So you act like this every time?”
“More often than not.”
“You are being weirdly nice.”
“Would you prefer the opposite?”
“Not sure.”
“It is too dramatic and I don’t like drama.”

Five minutes later.

“What are you doing?”
“I am going through a client brief.”
“A software requirement”
“I know software, software requirement is a bit blurry”
“Let’s just say it is the “plan” for building a software.”
“So you build software? How does that work?”
“This is no longer “a question”.”
“Sorry, was just trying to understand you.”
“You’re weird?”


“It was just a one night stand. Getting to know each other isn’t exactly a viable path, is it?”
“You made me breakfast.”
“I’m sorry?”

Slight frown.

“You seem like a nice lady, can we start this all over?”


“Hi, I’m Dami.”


“Hi, I’m Cynthia. You did this just to remember my name, yeah?”

Knowing smile.


“You seem like an ok guy.”
“You are a perceptive one.”
“Think I should leave now.”
“Alright. Want me to see you off?”
“No need, I know my way around.”

“I had a nice time, Cynthia”
“I did too, Dami. Have a nice day building software.”
“Thanks.” — —

What exactly are they?
A fragment is an independent Android component which can be used by an activity. A fragment encapsulates functionality so that it is easier to reuse within activities and layouts.

A fragment runs in the context of an activity, but has its own life cycle and typically its own user interface. It is also possible to define fragments without an user interface, i.e., headless fragments.

Meaning of you want an amount of flexibility with your UI manipulations in android, use fragments.

Starting new activities can be work intensive, switching fragments on the other hand is smoother.

An activity can hold as many fragments as possible.

Anything done with an activity can easily be replicated using a fragment.

Key points :
- Fragments run inside activities. Can’t have one without an originating activity.
- Fragments are easy to manipulate.
- Stop being scared of them.
- Two types of Fragment classes exist in the SDK, the app support v4 Fragment and the “”. Use the app support v4 fragments if you want compatibility for lesser versions of android.
- if and when you need a “Context”, use the getActivity() method.

Visit the site below for a hands on example. This is not a technical post.

Check out :