Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is View Injection in Java/Android?

Tags:

Can anyone tell me what is actually 'View Injection' in Android? What is happening when we use View injection library like ButterKnife and inject views?

PS: I know how to use Butterknife I only want to know how to answer if someone ask me what is View Injection in Android.

like image 230
Sudheesh Mohan Avatar asked Apr 28 '16 11:04

Sudheesh Mohan


1 Answers

ButterKnife is a library for using annotations in place of boilerplate code that we all do over and over again.

View injection is a concept in the MVC/MVVM design patterns that's all about decoupling the Views from their respective Controllers/View-Models.

Here is a very good explanation + example: http://www.developmentalmadness.com/2009/10/15/mvvm-with-prism-101-ndash-part-3b-view-injection-and/

With respect to ButterKnife, I don't know if it does much more than save you the need for fineViewById, but I haven't used ButterKnife yet so maybe I'm just not familiar with its capabilities.

like image 191
Vaiden Avatar answered Oct 04 '22 06:10

Vaiden