Android Development

Android Custom Alert dialog

Process One: Extending AlertDialog Class.. //in style.xml<style name=”AlertDialogStyle” parent=”Theme.AppCompat.Light.Dialog”> <item name=”colorAccent”>@color/colorAccent</item> <item name=”android:textColor”>@android:color/black</item> <item name=”android:textColorPrimary”>@color/colorPrimary</item> <item name=”dialogCornerRadius”>18dp</item> <item name=”android:background”>@color/bg_color</item> <item name=”background”>@color/bg_color</item></style> //create a class by extending AlertDialog class AddItemDialog( context: Context, private val listener: OnAddItemListener ) : AlertDialog(context,R.style.AlertDialogStyle) { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) //supportRequestWindowFeature(Window.FEATURE_NO_TITLE) setContentView(R.layout.layout_add_new) setTitle(“Add New Item”) submit_btn.setOnClickListener(View.OnClickListener { val title=title.text.toString().trim() val …

Android Custom Alert dialog Read More »

Android Project Setup

1.add java 8 compileOptions{ sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } 2.required dependency //recycler view implementation ‘androidx.recyclerview:recyclerview:1.1.0’ //retrofit implementation ‘com.squareup.retrofit2:retrofit:2.4.0’ implementation ‘com.squareup.retrofit2:converter-gson:2.4.0’ //jetPack component def lifecycle_version = “2.2.0” //viewModel+liveData implementation “androidx.lifecycle:lifecycle-extensions:$lifecycle_version” // Annotation processor(only for java 8) //annotationProcessor “androidx.lifecycle:lifecycle-compiler:$lifecycle_version” implementation “androidx.lifecycle:lifecycle-common-java8:$lifecycle_version” //paging implementation ‘androidx.paging:paging-runtime:3.0.0-alpha06’ Folder Structure

Android course outline basic

Android Development Course Outline Basic Android App Development Course (Online Android course With Kotlin) Location: Doesn’t matter. It’s Live Online Course Possible starting date of the course: 13 September, 2020 Class time: 8:00 PM to 10:00 PM (Bangladesh time), weekly two days. You don’t need any course! Learn yourself by following this guideline: https://hellohasan.com/2017/07/16/android-app-development-guideline/ Check …

Android course outline basic Read More »

Android spinner background

<?xml version=”1.0″ encoding=”utf-8″?> <selector xmlns:android=”http://schemas.android.com/apk/res/android”> <item> <layer-list> <item> <shape android:shape=”rectangle”> <padding android:left=”2dp” android:top=”4dp” android:right=”2dp” android:bottom=”4dp” /> <gradient android:startColor=”#ffffff” android:endColor=”#ffffff” android:angle=”270″ /> <stroke android:width=”3px” android:color=”@color/colorShadow2″ /> <corners android:radius=”5dp” /> </shape> </item> <item> <bitmap android:gravity=”center|right” android:src=”@drawable/ic_spinner_dropdown”/> </item> </layer-list> </item> </selector>

Android Studio Settings

Android Studio Setup Font Style 1.  Apperence Font : Segoe UI semibold 2.  Apperence Font Size : 11px 3. Code Font: Monospaced. 4. Code Font Size : 16 5. Code Line Space : 1.2 Plugins   1. Generate All Setter :    Author : burceGe    https://github.com/gejun123456/intellij-generateAllSetMethod 2.

Automatic popping up keyboard on start Activity

android:focusable=”true” android:focusableInTouchMode=”true” add these two line in parent of the Edittext …in example we added into cardview. <androidx.cardview.widget.CardView android:id=”@+id/note_search_layout” android:layout_width=”0dp” android:layout_height=”wrap_content” android:padding=”5dp” app:cardBackgroundColor=”@color/whiteBgcolor” app:cardCornerRadius=”5dp” app:cardElevation=”3dp” app:cardUseCompatPadding=”true” app:layout_constraintEnd_toEndOf=”parent” app:layout_constraintStart_toStartOf=”parent” app:layout_constraintTop_toTopOf=”parent” android:focusable=”true” android:focusableInTouchMode=”true”> <EditText android:id=”@+id/note_search” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:layout_margin=”5dp” android:background=”@drawable/bg_white_border_no” android:hint=”Search Note by title..” android:imeOptions=”actionSearch” android:inputType=”text” android:padding=”8dp” android:textSize=”15sp” /> </androidx.cardview.widget.CardView> Auto focus on edittext inside scrollview autofocus inside …

Automatic popping up keyboard on start Activity Read More »

Android MVVM (JAVA)

1. view ( activity , fragments, adapter etc.) 2. view-model 3. repository (viewmodel collects data from here) 4. model (collect data from web server or local db.) prerequisite We will develop a simple note app. prerequisite: basic knowledge of android development,such as 1. activity 2.recyclerview 3.adapter 4. paper database. (library for local nosql database ) …

Android MVVM (JAVA) Read More »

Non Swipeable ViewPager

REF: https://stackoverflow.com/questions/9650265/how-do-disable-paging-by-swiping-with-finger-in-viewpager-but-still-be-able-to-s package com.m27lab.messmanagerpro.app.classes; import android.content.Context; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.animation.DecelerateInterpolator; import android.widget.Scroller; import androidx.viewpager.widget.ViewPager; import java.lang.reflect.Field; public class NonSwipeableViewPager extends ViewPager { public NonSwipeableViewPager(Context context) { super(context); setMyScroller(); } public NonSwipeableViewPager(Context context, AttributeSet attrs) { super(context, attrs); setMyScroller(); } @Override public boolean onInterceptTouchEvent(MotionEvent event) { // Never allow swiping to switch between pages …

Non Swipeable ViewPager Read More »