Posts

Showing posts from August, 2020

English - Formal and Informal words

 The following English words could be used when you are in official discussion with your customer or supervisors. This is for quick reference.  Informal to Formal  Give - replaced with Provide Can you provide more information?  Childish -  replaced with  Immature Maybe  -  replaced with  Perhaps Hungry -  replaced with  Famished Problems -  replaced with  Challenges Good -  replaced with  Positive Danger -  replaced with  Peril Stubborn -  replaced with  Obstinate Put off -  replaced with  Postpone Here -  replaced with  Present Help  -  replaced with  Assist Start  -  replaced with Commence Mad  -  replaced with Insane Go up  -  replaced with Increase Tough  -  replaced with Difficult Book  -  replaced with Reserve

Android - Adding libraries to gradle file - quick reference

        The following lines of codes, which helps you to add the Gradle dependencies for your project quickly. I have listed out the widely used Gradle dependencies. Please let me know in the comment section if you like to add any other libraries. Let's check.. //Constraint Layout implementation 'androidx.constraintlayout:constraintlayout:1.1.3' //Material Design implementation 'com.google.android.material:material:1.3.0-alpha02' //Kotlin Coroutines implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.8" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.8" //Retrofit - for async API calls implementation 'com.squareup.retrofit2:retrofit:2.9.0' implementation 'com.squareup.retrofit2:converter-gson:2.9.0' //Lifecycle  implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' //Kodein - Dependency Injection framework implementation 'com.eygraber:kodein-di-generic-jvm:5.2.1' implemen

Edit text with clear button in Android app

This simple example would help you to create a edit text with clear button EditText editText = (EditText) findViewById(R.id.Editdob); drawable created to assign in edit text (in Activity/Fragment) final Drawable drawable = getResources().getDrawable( R.drawable.clear_edit_text); drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight()); editText.setCompoundDrawables(null, null, drawable, null); ImageView crossImageView = new ImageView(this); crossImageView.setImageDrawable(drawable); On touch listener for edit text (in Activity/Fragment) editText.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View arg0, MotionEvent arg1) { if (arg1.getX() > editText.getWidth() - drawable.getIntrinsicWidth() - 10) editText.setText(""); } return false; } });