Guru Patel

How to make an infinity sign on Android

We can make insert Infinity symbol on android using two ways. One with programmatically using DecimalFormatSymbols class and other with string resource in xml code. Here is xml and Kotlin code to make infinity symbol.  activity_main.xml MainActivity.kt Note:- (DecimalFormatSymbols which will not work some custom fonts.)

How to get Current Date in Readable format from currentTimeMillis

Here is the simple code to get Current Date from the System in readable format. In xml design write a code for button or just drag and drop Button from the Design tab. Set the listener for the button. Inside the Button listener  First of all get the time value from the System. Using System.currentTimeMillis() method, which will give time in milliseconds.  Second, use SimpleDateFormat class to get date value …

How to get Current Date in Readable format from currentTimeMillis Read More »

How to change resource drawable stroke and background color programmatically

We can set background of Button, Layout etc., from the resource drawable with border, corner. In some cases it is also required that we need to change the background and border color of resource programmatically.  It is quite simple and easy to change the stroke and background color of drawable with few lines of codes. …

How to change resource drawable stroke and background color programmatically Read More »

How to copy text to clipboard in android

Here is the example to copy and paste text to and from android app. Using ClipBoardManager class  ( Note:  use android.content.ClipboardManager to provide support for SDK > 11 and use android.text.ClipboardManager for SDK < 11. But it is now deprecated. There are no any special permission are required to copy and paste content. You can copy content from your …

How to copy text to clipboard in android Read More »