Posts

Showing posts from June, 2023

Padding to number at the begging using kotlin code

Padding to number at the begging using Koltin code  Sometimes we need to show number with leading zero of integer like Entry Number: 000005 So we need padding for that integer. In Kotlin we do it various way: -   The padStart() function in Kotlin is a string extension function that pads the beginning  of a string with a specified character or sequence of characters until the desired length  is reached.   The padStart() function takes two parameters:   length: The desired length of the resulting string after padding, it is Int type parameter. padChar: The character used for padding. padStart ( 5 , '0' ) here 5 is length of resulting string and ‘0’ is padded when create result string.   Example:   val yourString = "hello" val paddedResultString = yourString . padStart ( 10 , '*' ) println ( paddedResultString ) // Output String : "*****hello"   For Integer Variable: fun padBegining (intData: Int ): String {     return intData.toString(). padStart

Badrinath Temple From Rishikesh

Image
  Badrinath Temple is indeed a prominent and highly revered temple located near Rishikesh in the Chamoil District ,the state of Uttarakhand, India. Badrinath Temple is one of the Char Dham pilgrimage sites in Hinduism, along with Yamunotri, Gangotri, and Kedarnath. It is situated in the town of Badrinath, which is approximately 300 kilometers from Rishikesh. The temple is dedicated to Lord Vishnu and is considered one of the 108 Divya Desams, sacred shrines of Vishnu mentioned in the ancient Hindu scriptures. Badrinath Temple is nestled amidst the picturesque Garhwal Himalayas, near the banks of the Alaknanda River. Badrinath  Temple also called Badri Vishal or Badri Narayana Temple. The temple is believed to have been established by Adi Shankaracharya, a renowned Hindu philosopher and theologian, in the 9th century. The deity worshipped at Badrinath Temple is Lord Badri Vishal, an incarnation of Lord Vishnu. The temple's architecture showcases the traditional North Indian style, w

Navigation Jetpack Component With Custom ToolBar Example

Image
  The Jetpack Navigation Component is an Android library that simplifies the implementation of navigation within an Android app. It provides a set of APIs and tools to handle the navigation between different screens or destinations, such as fragments, activities.   Lots of benefits are there using Navigation Component like it Simplified navigation setup, Safe argument passing, Default animations and transitions, Back stack management, Deep linking support, Integration with other Jetpack libraries It has basically three key component : Navigation Graph: The navigation graph is an XML resource file that defines the logical flow and structure of your app's navigation. It represents the fragments and the possible paths or actions to navigate between them. Navigation Graph:The navigation graph is an XML resource file that defines the logical flow and structure of your app's navigation. It represents the fragments and the possible paths or actions to navigate between them. NavHost: T

Share pdf file or Image file using kotlin code example

Share pdf file or Image file using various other application in android Kotlin with code  Starting from Android version  7.0 (API level 24) and higher, the file:// URI scheme is no longer supported for sharing files between apps due to security reasons. Instead, we use  a FileProvider to share files with other apps. Otherwise we got error: FATAL EXCEPTION: main Process: com.nipa.xlsheetcreate, PID: 11878 android.os.FileUriExposedException: file:///storage/emulated/0/createXLSheet/06-15-23-14-28_document.pdf exposed beyond app through ClipData.Item.getUri() at android.os.StrictMode.onFileUriExposed(StrictMode.java:2141) For solving error we using provider , let’s check below code for sharing a file   Add in manifest file for permission: < uses-permission android :name ="android.permission.READ_EXTERNAL_STORAGE" />   Create a xml file in : res/xml/ provider_paths .xml Add code below: <? xml version ="1.0" encoding ="utf-8" ?> < paths >

Create XL sheet using kotlin and poi in android

Create XL Sheet using Kotlin and Apache POI library in an Android application follow below steps:  1. Create new Android application using Android studio 2. Add the dependencies for Apache POI in your project's build. Gradle file. Trying to add latest library  3. Add write permission for save xl file in storage of android device. 4. I use the XSSFWorkbook class from the POI library to create a new workbook and create a sheet within it. Code Example: val myWorkBook = XSSFWorkbook ( ) val sheet : Sheet = myWorkBook. createSheet ( "FirstSeetExample" ) 5. I also add header  style  of sheet example below:           val headerFont : Font = myWorkBook. createFont ( )   headerFont. color = IndexedColors. BLUE . index   val cellStyle = sheet. workbook . createCellStyle ( )   cellStyle. fillForegroundColor = IndexedColors. RED . getIndex ( )   cellStyle. setFont ( headerFont ) 6. Create model class for data and add data to model class:  

ঋষিকেশ থেকে গৌরীকুন্ড পর্যন্ত কেদারনাথ ধাম যাত্রার বর্ণনা

Image
ঋষিকেশ থেকে গৌরীকুন্ড পর্যন্ত কেদারনাথ ধাম যাত্রা হলো একটি অত্যন্ত পবিত্র ও ধার্মিক পথ। এটি চার ধাম যাত্রার অংশ এবং অন্য মহাকুমারী যাত্রাগুলোর মধ্যে এটি সবচেয়ে পুরাতন এবং গৌরবপূর্ণ। ঋষিকেশ থেকে সোনপ্রিয়াগ আপনার যাত্রা শুরু করতে, আপনার কাছে পাবলিক বাস পরিবহন, শেয়ার কার বা একটি ব্যক্তিগত গাড়ি বেছে নেওয়ার বিকল্প রয়েছে। 1. পাবলিক বাস পরিবহন: ঋষিকেশ সোনপ্রয়াগ  নিয়মিত বাস পরিষেবা সরবরাহ করে। কেদারনাথ বাস ঋষিকেশ থেকে ভোর 4:00 টায় শুরু হয়  ,আপনি ঋষিকেশের বাস স্ট্যান্ডে যেতে পারেন এবং সোনপ্রয়াগ  যায় এমন একটি স্থানীয় বাসের সন্ধান করতে পারেন। বাস টার্মিনালে এই বিশেষ তীর্থযাত্রা রুটের ব্যবস্থা আছে।  2> শেয়ার কার: আরেকটি বিকল্প হল শেয়ার কার ভাড়া করা। শেয়ার কারগুলি সাধারণত ঋষিকেশে পাওয়া যায়, এবং আপনি সেগুলিকে বাস স্ট্যান্ডের কাছে খুঁজে পেতে পারেন বা নির্ধারিত পয়েন্টগুলি ভোর 4:00 টায় শুরু হয়। এগুলি ভাগ করা যানবাহন যেখানে একাধিক যাত্রী একসাথে ভ্রমণ করে এবং ভাড়া তাদের মধ্যে ভাগ করা হয়। 3> ব্যক্তিগত গাড়ি: আপনি যদি পরিবহনের আরও ব্যক্তিগতকৃত এবং সুবিধাজনক মোড পছন্দ করেন তবে

Android Kotlin code for Create folder With Real-Time Permissions

 To create folder programmatically in android need runtime permissions in Android using Kotlin. First you have to create New Android Project Then steps as follow: In AndroidManifest.xml file you have to add code:  <!-- Permission required for the Android 11 (R) and above --> < uses-permission android :name ="android.permission.MANAGE_EXTERNAL_STORAGE" /> < uses-permission android :name ="android.permission.READ_EXTERNAL_STORAGE" /> < uses-permission android :name ="android.permission.WRITE_EXTERNAL_STORAGE" /> < application ...... android :requestLegacyExternalStorage ="true"> Create activity: MainActivity.kt Write below code: private const val TAG = "PermissionCheck" private const val STORAGE_PERMISSION_CODE = 100 class MainActivity : AppCompatActivity() { lateinit var binding : ActivityMainBinding private val storagePermissionsArray = arrayOf ( android. Manifest . permission . READ_EXTERN