Update RecyclerView Adapter Data in Android

Ankith Reddy
Updated on 30-Jul-2019 22:30:24

5K+ Views

Before getting into example, we should know what is Recycler view in android. Recycler view is more advanced version of list view and it works based on View holder design pattern. Using recycler view we can show grids and list of items.This example demonstrate about how to update Recycler View adapter by creating a beautiful student records app that displays student name with age.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Open build.gradle and add Recycler view & Card view ... Read More

Writing Files in Background in Python

Samual Sam
Updated on 30-Jul-2019 22:30:24

288 Views

Here we are trying to do two tasks at a time, one in the foreground and the other in the background. We’ll write something in the file in the background and of a user input number, will find if it’s an odd or even number.Doing multiple tasks in one program in python is possible through multithreading in Live Demoimport threading import time class AsyncWrite(threading.Thread):    def __init__(self, text, out):       threading.Thread.__init__(self)       self.text = text       self.out = out    def run(self):       f = open(self.out, "a")       f.write(self.text + '') ... Read More

Why is LIMIT 0 Allowed in MySQL SELECT Statements

karthikeya Boyini
Updated on 30-Jul-2019 22:30:24

1K+ Views

As you know if you use LIMIT 0 in MySQL SELECT statement, it returns an empty set.The LIMIT can be used when you want a specified number of rows from a result rather than the entire rows. If you use any MySQL API, then the job of LIMIT is to acquire the type of result columns.LIMIT 0 can be used to check the validity of a query. For more details use the following link −https://dev.mysql.com/doc/refman/8.0/en/limit-optimization.htmlHere is the demo of LIMIT 0. The query to create a table is as follows −mysql> create table Limit0Demo    -> (    -> Id ... Read More

Display Path Separator in Java

karthikeya Boyini
Updated on 30-Jul-2019 22:30:24

233 Views

To display the path separator, use the Properties class and import the following package −import java.util.Properties;Use the getProperties() method first and create an object −Properties p = System.getProperties();Now, set the key for path separator −p.getProperty("path.separator")The following is an example −Example Live Demoimport java.util.Properties; public class Demo { public static void main(String[] args) { Properties p = System.getProperties(); System.out.println("Separator is "+p.getProperty("path.separator")); } }OutputSeparator is :

Set Width and Precision to Format Output in Java

karthikeya Boyini
Updated on 30-Jul-2019 22:30:24

2K+ Views

Set width in output as shown below. Here, %10 sets a 10 character fieldSystem.out.printf("d1 = %10.2f d2 = %8g", d1, d2);Above, the value after the decimal is for decimal places i.e. 5.3 is for 3 decimal places −System.out.printf("d1 = %5.3f d2 = %2.5f", d1, d2);The following is an example −Example Live Demopublic class Demo { public static void main(String[] args) throws Exception { double d1 = 399.8877; double d2 = 298.87690; System.out.printf("d1 = %10.2f d2 = %8g", d1, d2); System.out.printf("d1 = %5.3f d2 = %2.5f", d1, d2); } }Outputd1 = 399.89 d2 = 298.877 d1 = 399.888 d2 = 298.87690

Create Animated Gradient Background in Android

George John
Updated on 30-Jul-2019 22:30:24

958 Views

Before getting into example, we should know what is Gradient color. According to Wikipedia, In computer graphics, a color gradient (sometimes called a color ramp or color progression) specifies a range of position-dependent colors, usually used to fill a region. For example, many window managers allow the screen background to be specified as a gradient.This example demonstrate about how to create Animated Gradient Background in android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml. ... Read More

Best Plugins for Building Attractive Website Pages

yashwanth sitamraju
Updated on 30-Jul-2019 22:30:24

174 Views

A plugin is that piece of software that gives additional functionality to a website. These plugins help the web browser to display additional content and increases the functionality of a website and makes it look great.Websites are usually created using WordPress, so let us discuss some of the best "Free WordPress Plugins" to help in building best and attractive website pages.AkismetJetpackEverest formsYoast SEOGoogle XML SitemapsNivo SliderW3 Total CacheVaultPressUser RegistrationWP Smush

Get Localized Day Name in Java

Samual Sam
Updated on 30-Jul-2019 22:30:24

251 Views

The following is an example.Example Live Demoimport java.util.Date; import java.text.DateFormat; import java.text.SimpleDateFormat; public class Demo { public static void main(String[] args) throws Exception { Date d = new Date(); DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss a"); String format = dateFormat.format(d); System.out.println("Current date and time = " + format); System.out.printf("Localized day name = %tA/%TA", d, d); } }OutputCurrent date and time = 26/11/2018 11:44:44 AM Localized day name = Monday/MONDAY

Count Total Even Numbers in Series of 10 Numbers using 8085

Anvi Jain
Updated on 30-Jul-2019 22:30:24

1K+ Views

In this program we will see how to count number of even numbers in a block of elements.Problem StatementWrite 8085 Assembly language program to count number of even numbers in a block of data, where the block size is 10D. The block is starting from location8000H.DiscussionThe Odd Even checking is very simple. we can determine one number is odd or even by checking only the LSb. When LSb is 1, the number is odd, otherwise it is even. In this program we are taking a number from memory and then ANDing01H with it. if the result is nonzero, then the ... Read More

Implement Android Pull to Refresh

Chandu yadav
Updated on 30-Jul-2019 22:30:24

695 Views

Before getting into example, we should know what is Pull to refresh layout in android . we can call pull to refresh in android as swipe-to-refresh. when you swipe screen from top to bottom it will do some action based on setOnRefreshListener.This example demonstrate about how to implement android pull to refresh.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In the above code we have given swipeRefreshLayout as parent ... Read More

Advertisements