Android Development

Option menu or Popup menu change background

  Ref: Add Popup-Menu style to your App-Theme: <style name=”AppTheme” parent=”android:Theme.Light”> <item name=”android:popupMenuStyle”>@style/PopupMenu</item> </style> <style name=”PopupMenu” parent=”@android:style/Widget.PopupMenu”> <item name=”android:popupBackground”>@android:color/white</item> </style>  

Android Activity Life-cycle

First opens Activity: onCreate(),OnStart(),onResume() User Clicks backButton(): onPause(),onStop(),onDestroy() Navigating to another screen: First Screen:: onPause(),onStop() Second Screen: onCreate(),OnStart(),onResume() Presses Backbutton in Activity2: Second Screen: onPause(),onStop() ,onDestroy() First Screen: onRestart(), onStart(), onResume() User locks the device: onPause(),onStop() Again Opens lock: onRestart(), onStart(), onResume()

RecycleView steals focus when inside a NestedScrollView

Reference Link: add this two line of code in parent or root viewgroup: < xmlns:android=”” android:layout_width=”match_parent” android:layout_height=”match_parent””> <LinearLayout android:layout_width=”match_parent” android:layout_height=”match_parent” android:focusableInTouchMode=”true” android:orientation=”vertical”> <View android:id=”@+id/someView” android:layout_width=”wrap_content” android:layout_height=”350dp”/> < android:id=”@+id/recyclerView” android:layout_width=”match_parent” android:layout_height=”wrap_content”/> </LinearLayout> </>

file was loaded in the wrong encoding android studio windows

Reference Link: Thanks to the Answer of Asim, I found deleting folder caches fixed the problem for my case (all gradle files in Android Studio show contents that have nothing to do with the actual contents of these files): Delete caches folder.then you are good to go. C:\Users\my_user_name\.AndroidStudio3.3\system\caches

Glide With Drawable

Reference Link: Sample Code: Glide.with(myFragmentOrActivity).load(imageUrl) .into(new CustomTarget(100,100) { @Override public void onResourceReady(@NonNull Drawable resource, @Nullable Transition

Admob Native advanced (Example)

All Admob Example : Admob Official Doc: Github Link:   you tube video:   FEED LAYOUT ADD======================================== <?xml version=”1.0″ encoding=”utf-8″?> < xmlns:android=”” android:layout_width=”match_parent” android:layout_height=”match_parent” xmlns:app=”” > <androidx.cardview.widget.CardView android:layout_width=”match_parent” android:layout_height=”wrap_content” android:layout_gravity=”center” android:background=”@drawable/bg_white_border_no” app:cardBackgroundColor=”@color/whiteBgcolor” app:cardCornerRadius=”10dp” app:cardElevation=”2dp” app:cardUseCompatPadding=”true” android:minHeight=”50dp”> <LinearLayout android:layout_width=”match_parent” android:layout_height=”wrap_content” android:orientation=”vertical” android:padding=”10dp”> <LinearLayout android:layout_width=”match_parent” android:layout_height=”wrap_content” android:orientation=”horizontal”> <ImageView android:id=”@+id/ad_app_icon” android:layout_width=”40dp” android:layout_height=”40dp” android:src=”@drawable/logo_xml” android:adjustViewBounds=”true” …

Admob Native advanced (Example) Read More »

কোডক্যানিয়নের জন্য এন্ড্রয়েড অ্যাপ ডেভেলপমেন্ট

কোডক্যানিয়নের জন্য এন্ড্রয়েড অ্যাপ ডেভেলপমেন্ট এন্ড্রয়েড জগতে আমি নতুন, বেশ কিছু বছর থেকে পিএইচপি নিয়ে কাজ করি। মাত্র ২ বছর আগে গুরু “হাসান আবদুল্লাহ” ভাইয়ার হাত ধরে এই সেক্টরে পথচলার শুরু। যেহেতু লেখালেখির মোটেও অভ্যাস নাই সেহেতু লেখাতে অনেক ভুলভ্রান্তি থাকাটাই স্বাভাবিক। ভুলভ্রান্তিগুলা ক্ষমাসুলভ দৃষ্টিতে দেখার অনুরোধ রইল। কারও কোন প্রশ্ন থাকলে ইনবক্স না করে …

কোডক্যানিয়নের জন্য এন্ড্রয়েড অ্যাপ ডেভেলপমেন্ট Read More »

Firebase Cloud Messaging (notifications)

library link: Reference link: official link: App Level Build.Gradle : implementation ‘’ implementation ‘’ step 1: create a service class that extends firebaseMessagingService class: public class FirebaseMessagingService extends { @Override public void onMessageReceived(RemoteMessage remoteMessage) { //get default notificaion data String mesgeTitle=remoteMessage.getNotification().getTitle(); //get extra data String msgType=remoteMessage.getData().get(“msg_type”); } } step 2: enable …

Firebase Cloud Messaging (notifications) Read More »

send data using Interface(bottom sheet to activity)

reference link: best: reference link:         1.First create an interface public static class ShowBottomSheetDialog extends BottomSheetDialogFragment { //stp 1 public interface BottomSheetListener{//step 1 void onUpdateClick(Object updatedInfo,String CallBackTag); } //stp 2 2.create a member variable or that interface private BottomSheetListener mBListener;//step 2 3.onattach init the member variable try { mBListener=(BottomSheetListener) context;//step 3 …

send data using Interface(bottom sheet to activity) Read More »

ViewPager with FragmentPagerAdapter (single fragment multiple content)

full Reference link: Define Fragments public class FirstFragment extends Fragment { // Store instance variables private String title; private int page; // newInstance constructor for creating fragment with arguments public static FirstFragment newInstance(int page, String title) { FirstFragment fragmentFirst = new FirstFragment(); Bundle args = new Bundle(); args.putInt(“someInt”, page); args.putString(“someTitle”, title); fragmentFirst.setArguments(args); return fragmentFirst; …

ViewPager with FragmentPagerAdapter (single fragment multiple content) Read More »