This is a simple example of Aspect Oriented Programming in Android

Overview

Android-AOPExample Build Status

This is a simple example of Aspect Oriented Programming in Android as part of a blog post I have written. The idea was to measure how long takes a method to be executed, so based on annotations, a Metrics aspect was created for making easy to trace a method execution (you can take a look at the 'gintonic' folder). I wrote an article about Aspect Oriented Development in Android here:

After developing this I realized Jake Wharton has already created a very useful library called Hugo (I refactored my code to look like this amazing library but mine is kind of a more primitive version, although as an example works fine :)).

The idea is simple, you just add @DebugTrace to any method and in the logcat you will see something like this:

Gintonic --> onMeasure --> [10ms]

Local Development

Here are some useful Gradle/adb commands for executing this example:

  • ./gradlew clean build - Build the entire example.
  • ./gradlew installDebug - Install the debug apk in the current connected device.
  • adb shell am start -n android10.org.viewgroupperformance/org.android10.viewgroupperformance.activity.MainActivity - Start the Main Activity of the example.

License

Copyright 2014 Fernando Cejas

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

http://www.fernandocejas.com

Buy Me A Coffee

You might also like...
simple android grocery app using kotlin and android studio
simple android grocery app using kotlin and android studio

Project Idea The idea of this project is to make a grocery android app that users can use to order the groceries they want. It doesn't contain any bac

A simple chat demo for socket.io and Android

socket.io-android-chat This is a simple chat demo for socket.io and Android. You can connect to https://socket-io-chat.now.sh using this app. Installa

A simple notes app to demo Room + LiveData implementation in Android
A simple notes app to demo Room + LiveData implementation in Android

RoomDb-Sample This is a demo app on how to implement Room persistance library, making use of LiveData in Android app How to implement Room: a SQLite o

🔥 Android MVP with Volley usage simple registration App 🔥

🔥 Android MVP with Volley usage simple registration App 🔥 This is a MVP architecture app that uses volley .Project is made using Android Studio. Vol

A simple sample showing the different types of notifications on Andoid

Notification example Simple notification. Expandable notification Progress notification Action button notification Notifications: MainActivity: Refs h

This repository provides a simple clicker app using `KSharedDataStorage` to save progress

kds-android-example This repository provides a simple clicker app using KSharedDataStorage to save progress For progress saving used KSharedDataStorag

A simple app demonstrates using Jetpack compose with other Jetpack libraries.
A simple app demonstrates using Jetpack compose with other Jetpack libraries.

Android Pokemon Compose This repository is a simple app that make request to https://pokeapi.co and display them in the paginated lists. It demonstrat

Quality-Tools-for-Android 7.5 0.0 L5 Java This is an Android sample app + tests that will be used to work on various project to increase the quality of the Android platform.
Quality-Tools-for-Android 7.5 0.0 L5 Java This is an Android sample app + tests that will be used to work on various project to increase the quality of the Android platform.

Quality Tools for Android This is an Android sample app + tests that will be used to work on various project to increase the quality of the Android pl

A sample project which can be used as a base in order to develop Media Library applications for Android TV.  Follow the series of blogs starting at http://www.malmstein.com/blog/2014/10/21/building-applications-for-android-tv/ in order to keep up to date with the process
Comments
  • How to use aspectj in another module

    How to use aspectj in another module

    I want to use gintonic module in another module to track the classes there. What should be the gradle structure. I tried all the combinations and nothing seems to work. Kindly advice.

    opened by winster 1
  • cant not run sample app , build failed ,why?

    cant not run sample app , build failed ,why?

    Error:(45, 1) Execution failed for task ':gintonic:compileReleaseJavaWithJavac'.

    No such property: project for class: com.android.build.gradle.LibraryPlugin

    using gradle 2.3.3

    opened by huajianjiang 3
Owner
Fernando Cejas
Director of Mobile @wireapp. DevRel. Engineering. @soundcloud Alumni. Former @IBM. Curious learner. Passionate Software Engineer. Geek. Quantum Computing
Fernando Cejas
This repo contains example code for O'Reilly's "Programming Android" by Zigured Mednieks, Laird Dornin, Blake Meike and Masumi Nakamura

This repo contains working code for the example in O'Reilly's _Programming Android, 2nd Edition_; Mednieks, Dornin, Meike, Nakamura (http://shop.orei

G. Blake Meike 165 Nov 11, 2022
Learning RxJava for Android by example

Learning RxJava for Android by example This is a repository with real-world useful examples of using RxJava with Android. It usually will be in a cons

Kaushik Gopal 7.6k Dec 30, 2022
The example Android project of animated menu items in toolbar

Android Animated Menu Items The example Android project of animated menu items in toolbar. Thanks Srikant Shetty for idea of this animation. Cut: Copy

Ilya Fomenko 922 Nov 23, 2022
Learning RxJava for Android by example

Learning RxJava for Android by example This is a repository with real-world useful examples of using RxJava with Android. It usually will be in a cons

Kaushik Gopal 7.6k Dec 29, 2022
Basic example of using ItemTouchHelper to add drag & drop and swipe-to-dismiss to RecyclerView.

Another drag and swipe library? This project is an example of basic drag & drop and swipe-to-dismiss with RecyclerView using ItemTouchHelper. It corre

Paul Burke 2.5k Dec 24, 2022
Example app for shortcuts

Android Shortcuts Example app for shortcuts in design library v25 Demo Manifest Add meta-data before </activity> tag in Manifest.xml <meta-data androi

Pamir Cevikogullari 334 Nov 29, 2022
An example that demonstrates how to integrate a learning app with the EIDU platform

EIDU Sample Learning App This app is an example of how to create a learning app that integrates with the EIDU platform. Please consult dev.eidu.com fo

null 0 Dec 17, 2021
Minimal example of how to safely share a file produced by a task in one project, with a task in another project.

How to share files across Gradle subprojects: A minimal example This is the Gradle project: . ├── producer │ └── build.gradle.kts ├── consumer │ └

Rob Moore 2 Dec 17, 2021
A simple app to showcase Androids Material Design and some of the cool new cool stuff in Android Lollipop. RecyclerView, CardView, ActionBarDrawerToggle, DrawerLayout, Animations, Android Compat Design, Toolbar

#Android-LollipopShowcase This is a simple showcase to show off Android's all new Material Design and some other cool new stuff which is (new) in Andr

Mike Penz 1.8k Nov 10, 2022
A simple app to showcase Androids Material Design and some of the cool new cool stuff in Android Lollipop. RecyclerView, CardView, ActionBarDrawerToggle, DrawerLayout, Animations, Android Compat Design, Toolbar

#Android-LollipopShowcase This is a simple showcase to show off Android's all new Material Design and some other cool new stuff which is (new) in Andr

Mike Penz 1.8k Nov 10, 2022