Some projects on android

Writing a modular project on Android

When we create a new project on Android Studio, it gives us one module, the app module. This is where a majority of us write our entire application. Each click on the run button fires a gradle build on our entire module and all the files in it are checked for changes. This is why gradle builds can take 10’s of minutes for larger applications and slow down developer output.

To solve this, complex applications like Uber decided to modularize their applications and have gained a lot from it. Following are some of the advantages of having a modular project

  • Faster gradle builds
  • Re-usability of common functionality across applications / modules
  • Easily pluggable into Instant apps
  • Better team work, as one person can have the sole responsibility of a module
  • Smoother git flows

Due to the above advantages, when I started off with the Posts application, I kept it in mind to use a modular approach from day one. The Android team has provided us with a few tools for it, but I did hit some roadblocks. Following are some of my learnings:

How do I split my modules?

Your application has sets of flows, for example, Google play has the application details flow, which contains the summary, description details, screen-shot and reviews activities.

All of these can fall under the same module — app-details .

Your application can contain multiple such flow modules like authentication , settings , on-boarding , etc. There are also modules which do not need a UI element to be present like — notifications , analytics , first-fetch etc. These modules contain the activities, viewmodels, repositories, entities and dependency injections pertaining to that flow.

But there are always some common functionalities and utilities these modules would want to share. This is why you need a core module.

What is in the Core Module ?

The core module is a simple library module in your project. The core module can, among other things,

  • Provide global dependencies to your dependency injection framework like Retrofit, SharedPreferences, etc.
  • Contain utility classes and extension functions
  • Contain global classes and callbacks
  • Initiate libraries like Firebase Analytics, Crashlytics, LeakCanary, Stetho, etc in the application class.

How do I use 3rd party libraries?

One of the main responsibilities of the core module is to also provide external dependencies to your feature modules. This makes it easy to share the same version of a library among all your features. Just mark the dependencies with api in your core module and all your dependent feature modules would be able to receive them.

There is a possibility of a dependency only being useful in feature-a module but not in feature-b , both of which depend on core . In that case too, I would recommend to define your dependency in the core with api as proguard will take care of not including it into the feature-b instant app.

How do I use Room?

This one confused me for the longest time. We would want to define our database into the core module as it is a common functionality our application will want to share. For Room to work, you need a database file with all the entity classes mentioned into it.

But, as mentioned above, our entity classes are defined in the dependent feature modules and the core module cannot access them. This is where I hit a roadblock, and after some thought did the best thing you can do, ask Yigit for help.

Читайте также:  Как отключить голосовое оповещение андроид

Yigit clarified that you will have to create a new db file into each feature module and have a database per module.

This has some advantages:

  • Migrations are modularized
  • Instant apps contain only those tables they need
  • Queries will be faster
  • Cross module data relations won’t be possible

Note: Do not forget to add the following dependencies into your feature modules for Room’s annotations to work

How do I use Dagger 2?

The same problem as Room was hit with Dagger too. My application class in the core module would not be able to access and initialize my feature module components. This is the perfect use-case for dependent components.

Your core component mentions the dependencies it wants to expose to the dependent components

Your module components define the CoreComponent as a dependency and use the passed on dependencies

Where do I initialize my components?

I created a singleton holder for all the components of my feature. This holder is used to create, maintain and destroy my component instances.

Note: Do not forget to add the following dependencies into your feature modules for Dagger’s annotation process to work

Conclusion

Although there are some tricky parts to convert your monolithic application into modules, some of which I tried to solve above, the advantages are profound. If you hit any roadblock with your modules, feel free to mention them below and we may work together on a solution.

Источник

Интересные приложения для Android с открытым исходным кодом

Используя и изучая приложения с открытым исходным кодом, вы можете научиться, как создавать хорошие приложения самостоятельно.

Ниже перечислены лучшие проекты под Android с открытым исходным кодом. Благодаря им вы сможете узнать массу отличных практик для разработки под Android.

1. Android-приложение с MVP архитектурой

Этот репозиторий содержит приложение, которое реализует архитектуру MVP с использованием Dagger2, GreenDao, RxJava2, Fast-Android-Networking и PlaceholderView.

2. Android-приложение с MVVM архитектурой

Этот репозиторий содержит приложение, которое реализует архитектуру MVVM с использованием Dagger2, GreenDao, RxJava2, Fast-Android-Networking и PlaceholderView.

3. Google I/O Android-приложение

Google I/O — это конференция разработчиков, которая проводится каждый год. На ней представлены сотни демонстраций технологий от разработчиков.

Этот проект — Android-приложение для конференции. Приложение поддерживает устройства под управлением Android 5.0+ и оптимизировано для телефонов и планшетов всех форм и размеров.

4. Чертежи архитектуры Google Android

Платформа Android обладает большой гибкостью, когда организует и архивирует приложение. Эта свобода может привести к приложениям с большими классами. Это может затруднить тестирование, поддержку и расширение.

Архитектура Android Blueprint предназначена для демонстрации возможных способов помочь в решении этих проблем. Этот проект показывает одно и то же приложение, реализованное много раз с использованием различных архитектурных концепций и инструментов.

Вы можете использовать эти образцы как отправную точку для создания собственных приложений. Здесь основное внимание уделяется структуре кода, архитектуре, тестированию. Однако имейте в виду, что существует множество способов создания приложений с этими архитектурами и инструментами. Сосредоточьтесь на своих собственных приоритетах и не слишком увлекайтесь тем, что можно считать каноническими примерами.

5. Telegram

Telegram — это приложение для обмена сообщениями с акцентом на скорость и безопасность. Этот мессенджер супер быстрый, простой и бесплатный. Данный репозиторий содержит официальный исходный код андроид-приложения для Telegram.

6. Plaid

Приложение под Android, которое способно вдохновить своим дизайном, благодаря отличной реализации material design.

7. Wire

Это приложение чата полно картин, фильмов, GIF, музыки, эскизов и других форм мультимедиа. Также оно всегда обеспечивает безопасное сквозное шифрование.

8. Андроид-приложение ribot

Официальное приложение ribot для Android, в котором реализованы архитектура, инструменты и рекомендации, которые команда поддерживает для платформы Android.

9. Kickstarter

Kickstarter — это глобальное сообщество, которое помогает воплощать творческие проекты в жизнь. Изучайте тысячи проектов в области искусства, дизайна, фильмов, игр, музыки и т. д.

10. PocketHub

GitHub отказался поддерживать приложение, поэтому оно было выпущено «в люди» и поддерживается как публичный проект. Сейчас общество активно работают над переизданием этого приложения в Play Маркет. Это приложение станет духовным преемником оригинального приложения.

11. Простое андроид-приложение с MVP

Очень простое приложение, показывающее, как реализовать архитектуру MVP.

Источник

Tek Eye

The lists of Android sample projects in this article illustrate various Android programming techniques. Scroll down or click on these topics for free Android example projects on:

Читайте также:  Серви серф для андроида

The Android projects listed below cover a wide range of subjects. All the following projects were tested in the version of Android Studio available at the time. Studio is a free Integrated Development Environment (IDE) provided by Google for Android app development. (An IDE is a software environment used for writing software, in this case Android apps).

All these free Android example projects come with the source code in a zip archive for importing into Android Studio. A tutorial web page provides a lesson for each of the projects. The example source code is ready to run in Android Studio. Extract the sample app project and use Android Studio import. How? Here’s a quick guide:

  1. Extract the zip file contents to the required location (preserving directory structure). Studio does not move the project.
  2. Run Android Studio and use the Import project option. Import is on the New option from the File menu, or on Studio’s Welcome screen. (To get to the Welcome dialog close any open projects.)
  3. Select the project directory, or the top level build.gradle file in the project directory.
  4. Accept the sync Gradle message (if displayed) and wait for the IDE to finish configuring the project (look at the status bar at the bottom of Studio).
  5. When the Run icon (play button) on the toolbar goes green the example project is ready to use.

When opening projects in updated versions of Studio import errors can occur. See the article Opening Pre-Android Studio 3 Projects for tips on resolving errors caused by updates to Studio.

(Import instructions also appear in each zip archive in the file instructions.txt.)

Free Projects to Illustrate Android Programming Techniques

This list of Android example projects will expand as other Android tutorials and code examples are added to the site. A full list of all the Tek Eye Android articles can be found in the Index. A few of the Android examples were contributed to the O’Reilly Android Cookbook. The following tables contain:

  • A link to the tutorial article for each Android example project.
  • A link to a zip file containing the source code for the example project that can be extracted and then imported into Studio.
  • In the pipeline: A link to a compiled version of the example as a signed installable Android packages (.apk file). Ready for executing immediately on an Android device or emulator.

List of Free Android Example Projects

Article Source Package
Your First Android Java Program HelloWorld.zip planned
Start a Second Android Activity secondscreen.zip planned
Android String Resources Gotchas stringsxml.zip planned
Android AsyncTask Class Helps Avoid ANRs slowprocess.zip planned
Different Ways to Code Android Event Listeners codinglisteners.zip planned
Testing Android’s Activity Lifecycle lifecycletesting.zip planned
Saving Activity State in an App when it’s Interrupted restorestate.zip planned
Use the ZXing Barcode Scanner in an Android App scanbarcode.zip planned
Animated Images in Android lights.zip lights.apk
Web Search Example In Android websearch.zip planned
Android Dice Roller Source Code android_dice_roller.zip Dice.apk
Email Contact Form Using ACTION_SEND send-email-example.zip planned
Changing the Font for Android TextViews fonts.zip planned
Understanding Screen Resolutions and Density density-test.zip planned
Android API Demos apidemos.zip planned
Android Bitmap Loading bitmap-loading.zip planned

List of Free Android Example List Handling Projects

Article Source Package
Add a Simple List to an App simplelist.zip planned
Change ListView Text Color in Android redlist.zip planned
Two Line Lists in Android two_line_listactivity.zip planned
Multi Line ListView Entries in Android multi-line.zip planned
Read the Selection From a Multi Line ListView read-multi-line.zip planned

List of Free Android Example UI Projects

Article Source Package
Access Android View in Activity view-id.zip planned
Displaying a Bitmap in Android imageview-bitmap.zip planned
Add a Border to an Android Layout layoutborder.zip planned
No Tooltips for Android — Use Hint hintexample.zip planned
Limit EditText Input with Attributes and TextWatcher percentage.zip planned
Android Portrait and Landscape Screen Layout Example portrait-landscape.zip planned
ImageButton Graphics with Inkscape buttonpress.zip planned
Android 9 Patch Image Files for Buttons and Borders ninepatch.zip planned
About Box in Android App Using AlertBuilder aboutbox.zip planned
Swipe View Android Example for Screen Paging text_swiper.zip planned
How to Get View Size in Android view-size.zip planned
Load Values into an Android Spinner loading_spinner.zip planned
Changing Android Spinner Text Size with Styles styling_spinner.zip planned
Android Menu Vs Action Bar with Example Code menu-demo.zip planned
Context Menu Example for Android context-menu.zip planned
SeekBar Demo for Android seekbar-demo.zip planned
UI Update Demo for Android is-prime-app.zip planned
Pop-up Window Demo for Android android-pop-up.zip planned
Android Color Picker Tutorial color-picker.zip planned
HTML5 in Android App for WebView Display show-html.zip planned

See Also

  • There are free Android Developer online samples for the Android SDK available via Studio, see the article Android SDK Samples.
  • View the Tek Eye full Index for other Android articles and other interesting technical articles.
  • There are samples filterable by language and technology type on the Android Developers website.
  • For some interesting fun facts on Android see the Android Infographic at techjury.

Archived Comments

Leo Stalin on January 9, 2013 at 10:56 am said: I am an Android programming beginner.

Tek Eye on January 9, 2013 at 4:45 pm in reply to Leo Stalin said:

Arun kumar G on February 9, 2013 at 2:41 pm said: Hello Sir. This is very useful for me as I’m trying to get into the Android field. I need your help a lot sir. Definitely I’ll utilize you a lot. Thank you Sir.

Bimal on February 23, 2014 at 6:00 am said: Hi! I’m very new in android. I’m a VB developer. Now I need a simple project as follows. How can I get this project. I need source code with full comment. After reading the comment I can compile it my self. I use Android Studio. Thank you.

The project should have 5 editboxes, 1 combo and 1 command button. User will enter numbers in EditBox1. The length may be 16-18 numbers. Then user will select a item from combo. Combo should have 5 items. Then user will click on the button. In click event of the button, I want first 5 number need to go in EditBox2. Second 4 number need to go in EditBox3. Rest of the number need to go in EditBox4. In the last textbox number length may be 7,8 or 9. After breakdown of the string I want to find sum of all EditBoxes: Editbox1 + Editbox2 + EditBox3.

Then I want to subtract a number from the sum value. (Editbox1 + Editbox2 + EditBox3) – a number like 5560 or 6612 or 4258 etc. The subtraction number may be variable, because it depends on list item selected by user. Then I want the result in a Editbox5.

I need this project in email. My email is gpbimal@yahoo.com. If it is payable I will pay for this.

Tek Eye on February 24, 2014 at 8:35 am in reply to Bimal said: If you are familiar with VB take a look at these alternative Android programming IDEs:

Vladislav Bauer on August 10, 2014 at 11:56 am said: A lot of useful open source libraries, tools and projects could be found here: https://android-arsenal.com/

Tek Eye on August 11, 2014 at 10:42 am in reply to Vladislav Bauer said: Thanks for the link, a good place for Android developers to browse for components and other useful items.

Arya on October 4, 2014 at 5:45 am said: Good one.

Sushmita Singh on October 1, 2015 at 10:00 am said: Hey I want an shopping site related mini project.

Asad on October 8, 2016 at 3:39 pm said: How to open zip files in android studio?

Tek Eye on October 10, 2016 at 7:26 am in reply to Asad said: Extract the files first. A good utility for zip files is 7-Zip. Instructions for Studio are at the top of this page.

Geethadevi on January 29, 2017 at 7:39 am said: Useful to illustrate the Android programming techniques.

Author: Daniel S. Fowler Published: 2011-11-23 Updated: 2019-07-21

Do you have a question or comment about this article?

(Alternatively, use the email address at the bottom of the web page.)

↓markdown↓ CMS is fast and simple. Build websites quickly and publish easily. For beginner to expert.

Free Android Projects and Samples:

Источник

Читайте также:  Chic empire mod android
Оцените статью