Posts

Showing posts from June, 2025

How AI and VAEs Are Powering Smart Android Apps for Personalized Patient Health Monitoring

Image
  Imagine a health app that doesn’t just remind you to take your medication—but understands your medical history, monitors your vitals in real time, and can even predict when something’s wrong before you feel it. Welcome to the future of healthcare, driven by Artificial Intelligence (AI) and Variational Autoencoders (VAEs) —and it's already here, quietly revolutionizing how Android apps are built to manage patient health more intelligently than ever before. The Evolution of Health Apps: From Basic to Brilliant Most health apps today are pretty straightforward: track steps, count calories, maybe give you reminders medication reminders. Useful? Sure. But transformative? Not really. What’s changing the game is the integration of AI models —especially deep learning tools like VAEs—into smart Android apps that are built to handle complex medical data, spot patterns, and adapt in real time. These apps don’t just track—they learn, predict, and act. So, What Exactly is a VAE? A...

Learning Like Atom: How a Robot Boxer from Real Steel Taught Me to Embrace AI

Image
I remember the first time I watched Real Steel . I went in expecting an action-packed robot boxing movie. I wasn’t prepared to walk out inspired to learn about artificial intelligence. But there I was — watching Atom, a beat-up, outdated robot, go from the scrapyard to the championship ring — and something clicked. Atom didn’t have the power of the newer bots, the speed of the elite models, or even the voice to speak for himself. But what he did have was something incredibly powerful. He could learn . The Underdog That Learned to Fight Atom wasn’t built to be a champion. He was a sparring robot — a punching bag. But as Charlie, a struggling ex-boxer, trained with him, Atom began to change. He watched. He copied. He improved. With every punch, every dodge, every defeat, Atom got better. Not because he was reprogrammed, but because he learned — from experience, from observation, from failure. And I couldn’t help but think: That’s what AI is all about. The Mirror Between a Rob...

Part 2: Types of Android Tests – Unit, UI, Integration & End-to-End

  Understand the purpose, tools, and trade-offs of each test type before you write a single line of code. Introduction Before writing your first test, you need to understand the different types of tests available — and when to use them. This post will walk through the four major categories of Android tests : Unit Tests UI Tests Integration Tests End-to-End (E2E) Tests Each test has a purpose. And knowing when not to use one is just as important as knowing when to use it. Why This Matters If you only write UI tests, your tests will be slow and fragile. If you only write unit tests, you’ll miss how features interact. If you don’t test at all — you’re flying blind. A good Android test suite balances speed, confidence, and coverage. That’s where the test pyramid comes in. The Android Testing Pyramid UI Tests (Espresso) Integration Tests (Fakes) Unit Tests (JUnit, Mockito) Unit Tests are fast, small, and easy to maintain. Write ...

Part 1: Why Testing Matters in Android Development

  Real reasons developers should test — and how it helps more than it hurts Introduction Most Android developers know they should write tests — yet many avoid it. Common excuses include: "It slows me down." "My app isn’t big enough to need tests." "I don’t know where to start." This post is here to change that mindset. Testing isn’t a chore — it’s a productivity tool . When done right, it makes development faster, safer, and less frustrating. This series will show you how. The Hidden Cost of Untested Code Picture this: You fix a bug, ship a release, and a few days later crash reports spike. That “quick fix” accidentally broke something else. Without tests: Small changes are risky Bugs go unnoticed until users complain Refactoring becomes slow and stressful With automated tests: You catch regressions early You can refactor confidently You reduce manual testing effort You write better, more maintainable code ...

Android Testing Masterclass – A Complete Blog Series

  A step-by-step guide to mastering Unit Testing, UI Testing, and End-to-End Testing in Android. This post is the official index and will be updated as the series progresses. Welcome If you're an Android developer who’s ever struggled with fragile code, broken UIs, or unpredictable bugs, this series is for you. This is a complete, no-fluff tutorial series on Android testing — from unit tests with JUnit to UI tests with Espresso, mocking with Mockito, integration strategies, and clean architecture. Each post also includes interview questions and answers to help you prepare for technical interviews or strengthen your foundations. All content is self-contained within the blog — no external repos or tools required. What You’ll Learn Writing unit tests for business logic with JUnit Mocking dependencies with Mockito Creating stable UI tests using Espresso Structuring integration and end-to-end tests Practicing test-driven development (TDD) Designing testable ap...
  Perfect — here's how to create a   clean, reusable utility method   to hide the keyboard across all activities or fragments, including   ChatActivity . ✅ Step-by-Step: Make  hideKeyboard  a Reusable Utility 🔹 Step 1: Create a Kotlin File for Extensions 📄  KeyboardUtils.kt  (create under  com.seneca.dayamed.utils  or your preferred utils package): package com.seneca.dayamed.utils import android.app.Activity import android.view.View import android.view.inputmethod.InputMethodManager import android.content.Context fun Activity.hideKeyboard() { val imm = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager val view = currentFocus ?: View(this) imm.hideSoftInputFromWindow(view.windowToken, 0) view.clearFocus() } ✅ This will work in any  Activity . You can also extend this to  Fragment  or  View  if needed later. 🔹 Step 2: Use It in  ChatActivity In  ChatActivity , updat...

What My Dad Taught Me About AI—Without Knowing Anything About It

Last night, I was discussing artificial intelligence with my dad over dinner. He’s not a tech expert. He doesn’t know what ChatGPT is. He doesn’t follow AI news. But what he said stopped me in my tracks: “AI is like when computers came. Everyone thought we’d lose jobs, but more jobs came. You just need to learn new things. Same now.” Simple. Clear. Wise. And he’s absolutely right—because he lived through India’s computer revolution . And what we’re seeing with AI today? It’s history repeating itself. A Flashback to the 90s: The Computer Panic Back then, people were afraid. Clerks, typists, accountants—entire professions feared they’d be replaced by machines. There were protests. Strikes. Resistance. My dad remembers how even in banks and government offices, there was fear that computers would make humans useless. But what happened? Those who resisted got left behind. Those who learned built new careers. And those who adapted transformed India. Entire cities like Bengal...

Build a Real-Time Chat App in Android with PubNub (Kotlin + MVVM) – Part 1: Introduction

By Revansiddappa Kalshetty Real-time messaging has become a critical feature in today’s mobile apps — from social networks to support systems and team collaboration tools. But building it from scratch can be challenging: server setup, websockets, message queuing, typing indicators, presence, and so much more. Luckily, you don’t have to do it all yourself. In this tutorial series, I’ll show you how to build a modern, scalable in-app chat feature for Android using Kotlin , MVVM architecture , and PubNub , a powerful platform that handles the heavy lifting of real-time infrastructure. What You’ll Build Here’s a sneak peek of the features we’ll implement in this tutorial series: Real-time messaging using PubNub Chat history with message persistence Online/offline presence tracking Typing indicators Media sharing (optional) Push notifications (optional) Secure access with PubNub Access Manager (PAM) Multi-channel & group chat support All of this will be...

Build a Real-Time In-App Chat in Android Using PubNub (Kotlin + MVVM) – Complete Tutorial Series

Image
  Want to add real-time chat to your Android app without building an entire backend? In this tutorial series, you'll learn how to create a modern, scalable real-time in-app chat using Kotlin , the MVVM architecture , and PubNub — a robust platform built specifically for real-time communication. This post is your go-to index for the entire series. I’ll update it with links as each part goes live. Bookmark it now! Why PubNub? PubNub is a real-time communication platform that removes the complexity of building low-latency messaging and presence systems. Here’s what it offers out of the box: 🔧 Core Features for Android (Kotlin) Real-Time Messaging – Send and receive messages across any number of devices instantly. Message Persistence – Store and retrieve message history. User Presence – Detect when users come online or go offline. Typing Indicators – Show “User is typing…” live updates. Channel Groups – Organize multiple chatrooms or group threads. Push Notifications ...

How I Fixed My Messy Android Code with 5 Simple SOLID Principles (Using Kotlin)

Image
  If your Android app is hard to manage, crashes often, or feels like a mess — these 5 simple ideas can help make it clean, stable, and easier to work with. The Problem I Faced When I first started building Android apps, I wrote everything inside one file. My MainActivity had code for: Showing the UI Sending network requests Saving data And even handling user login It worked… until it didn’t. Small changes started breaking things. It became hard to test. Bugs popped up everywhere. The app felt fragile . The Solution: SOLID Principles Then I found something called SOLID — 5 simple ideas that help you write better, easier-to-understand code. They aren’t complicated. In fact, they made my life easier. Let me explain each one, with real and simple examples in Kotlin , so you can start using them too. What is SOLID? SOLID is a group of five principles: Letter Name Meaning S Single Responsibility One class = one job O Open/Closed Add f...

Most Developers Build Offline-First Apps Wrong — Here's What They Miss with Room

Image
  When you say your app works offline… does it really? A surprising number of Android developers proudly add “offline-first” to their app descriptions. And sure, the app opens without internet. Maybe it even loads a few screens. But dig a little deeper and it becomes clear: most offline-first implementations fall apart fast. Why? Because building an offline-first experience isn’t about just storing data locally. It’s about doing it intentionally , with the right structure, cleanup, and flow. And the culprit behind most of the silent issues? Room Database. Not because Room is bad — but because it's misunderstood. Let’s walk through some of the most common mistakes developers make when using Room in offline-first apps — and what to do instead. Mistake 1: Saving the Entire API Response into Room Many devs take the raw JSON response from their API and store it directly into Room entities — every field, every nested object, even things the app never uses. Why it’s a probl...

From Messy to Masterpiece: How Coding Standards Rescued Our Kotlin App

Image
"The app works, but the codebase feels like a haunted house." That’s how our junior dev described our project. And honestly, they weren’t wrong. When we started building our Android app in Kotlin, everything was exciting — fast screens, sleek UI, clever logic. But within a few months, we were buried in bugs, confused by code, and frustrated during every PR review. The problem? We had no coding standards. Just a jungle of inconsistent logic. So we turned things around — not with a rewrite, but with a code clean-up campaign powered by Kotlin’s best practices. Here’s how we fixed our mistakes — and how you can too. MISTAKE #1: Wild Formatting Wars No indentation rules. Random semicolons. Files looked like ransom notes. Before: fun fetchuser():List<User>{return userlist;} After (Using Kotlin style guide): fun fetchUser(): List<User> { return userList }   Fix: We adopted 4-space indentation, removed semicolons, and formatted consistently with ktlint . Benef...

"Retry When Ready" — A Smarter Way to Handle Network Failures in Jetpack Compose

Image
  " Please try again." These are the words users dread to see — especially when they’ve done nothing wrong except have poor internet. In this post, I’ll show you how to build a reusable, respectful retry system in Jetpack Compose that: Remembers failed API requests Waits for internet to return Gently asks the user: “Would you like to retry?” Works not just for login — but any network-dependent call Let’s build this like a good story: with empathy, architecture, and a clean separation of concerns. The Problem: Network Failures Break Trust Imagine this: A user opens your app and enters their login credentials. They tap Log In . Nothing happens — or worse, an error appears: “Login failed. Please try again.” Why? No internet. Maybe they walked through a tunnel. Maybe their Wi-Fi dropped. Now imagine if the app said: “You're back online. Would you like to retry logging in?” Boom. That's thoughtful UX. The Goal We want to create a centraliz...

Kotlin is King: A New Era of Joyful Development

Image
  There’s a moment every developer remembers—that time when they tried Kotlin for the first time and thought: “Wait… why isn’t all code like this?” For me, it started with a simple data model. I rewrote it from Java into Kotlin and saw 27 lines turn into five. Not just fewer lines— better lines. Cleaner. Safer. More expressive. It felt like discovering a cheat code. And I wasn’t alone. Since JetBrains introduced Kotlin, and especially after Google made it an official language for Android in 2017, the language has quietly—and confidently—earned its crown. This isn’t a rebellion. It’s a renaissance . Let’s talk about why Kotlin is King , and why so many developers are not just using it—but loving it.  Kotlin’s Superpower? Developer Happiness Kotlin isn’t trying to be flashy. It’s trying to be thoughtful . It solves real problems with elegant, modern solutions—and you can feel that care in every line of code. Here’s what makes Kotlin so powerful in practice: 1. Conc...