Skip to main content

Dependency Injection using Hilt

 Few Essentials to know


1. @HiltAndroidApp

2. Constructor Injection & Field Injection - @Inject

3. @AndroidEntryPoint

4. @Module, @InstallIn

5. @Provides

6. @Binds

7. @ActivityScoped/@Singleton/@ViewModelScoped etc

8. ActivityComponent, FragmentComponent, SingletonComponent etc.


Please complete the codelab practice 

https://developer.android.com/codelabs/android-hilt#0


Full Reference

https://developer.android.com/training/dependency-injection/hilt-android


Comments

Popular posts from this blog

Circular Seek Bar - Example

MyView.java package com.rakesh.androidcircularseekbar; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.RectF; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; public class MyView extends View {     /** The context */     private Context mContext;     /** The listener to listen for changes */     private OnSeekChangeListener mListener;     /** The color of the progress ring */     private Paint circleColor;     /** the color of the inside circle. Acts as background color */     private Paint innerColor;     /** The progress circle ring background */     private Paint circleRing;   ...

SSL pinning in Android - A brief discussion

HTTP protocol Communication between the client and a server typically non-encrypted or plain text while we use HTTP protocol.  Pitfall Any middle hacker can interrupt the connection between the client and server and manipulate the data as it involves no encryption. How to overcome this ? As the domain owner one can purchase a digital certificate from CA(Certificate Authority) who are considered as trusted.  A certificate will contain the Owner's name, public key , Issuer's(CA's) name,Issuer's(CA's) signature, domain details, expiry date etc . After the SSL/Leaf certificate is associated with a domain,the communication between client and server will be encrypted. Now the HTTP will become HTTPs. Note : Associating the SSL certificate means it enable the encryption between client and server but does not mean ,the domain owner will never misuse your personal information. How does SSL work ? Pitfall There is a problem here. Let's assume that there is a hacker comes i...

Android-PageViewer

source code   here I've searched for a page Viewer to swipe the pages for the better view .. I found some of the snippets while searching for that ... I used  the dotted Indication using  CirclePageIndicator in my package "com.rakesh.view" The Java files in this package are CirclePageIndicator.java public class CirclePageIndicator extends View implements PageIndicator {     private static final int INVALID_POINTER = -1;     private float mRadius;     private final Paint mPaintPageFill = new Paint(ANTI_ALIAS_FLAG);     private final Paint mPaintStroke = new Paint(ANTI_ALIAS_FLAG);     private final Paint mPaintFill = new Paint(ANTI_ALIAS_FLAG);     private ViewPager mViewPager;     private ViewPager.OnPageChangeListener mListener;     private int mCurrentPage;     private int mSnapPage;    ...