Recyclerview Adapter Library

It may be time consuming expect if you are doing it as part of learning. Adapter class and is assiged to the recycler view via the RecyclerView. Download for AndroidX. Then, let's say that you load your images in your RecyclerView. you can create this ViewHolder class in a. Instead of creating and binding Views, your RecyclerView. The input to the adapter of an recycler view can be any arbitrary Java objects. It acts as an intermediary between the data and the View. 그 Adapter에 데이터를 포함하게 된다. In other to achieve this you have the write your own complete solution. We can safely say that almost 90% of the android apps out there uses recyclerview. Adapter and it. In the end the process looks like this:. The AdapterDelegates library also provides a base class ListDelegationAdapter that already puts together RecyclerView. This tutorial will cover adding sticky headers to your existing implementation in just a few lines using qiujayen’s Sticky-LayoutManager library. How to create a RecyclerView? Before we do that we have to add a dependency to the build. So, new-> Java class and name it RecyclerViewAdapter. In src folder create abstract class with name BaseCursorAdapter. RecyclerView Animators is an Android library that allows developers to easily create RecyclerView with animations. This new component is a big step because the ListView is one of the most used UI widgets. Now we have already created two classes for divider and vertical spaces. In this tutorial, we are going to learn how to render a simple RecyclerView with a custom layout. Most use cases require the same base logic, but require you to write everything again and again. The input to the adapter of an recycler view can be any arbitrary Java objects. retrofit recyclerview paging pagination pagedlistadapter library github arch android. Android Recyclerview in the advanced version of the listview. For example, let’s say that we have a RecyclerView that contains a list of image urls where each position in the RecyclerView displays a single URL. Start here if you’re new to MultiViewAdapter. Questo pattern riduce al minimo il numero di chiamate al dispendioso metodo findViewById. What is a tracker? A tracker is what's going to allow the selection library to track the selections of the user, we are going to need it to check if a specific item has been selected or not. With all that set, all that is needed is to attach this created adapter of ours to our RecyclerView. This new. In this course, Android Fundamentals: Views and Adapters you'll understand how to implement Adapters for various use case scenarios. We have collection of more than 1 Million open source products ranging from Enterprise product to small libraries in all platforms. In this post, I am concentrating on kotlin retrofit android example program. In Android, RecyclerView is an advanced and flexible version of ListView and GridView. SwipeRefreshLayout with ListView (deprecated). Please feel free to use this. RecyclerView. It recycles the views it created at the begining when the views go out of scope (window) and then if there is a need, reuses them to make it seem as if the views were never offloaded and were virtually present outside the window. Menambahkan data pada recyclerview diperlukan LinearLayoutManager yang diperlukan oleh RecyclerView untuk mengatur setiap item (child) pada listnya. You retain control over the visual presentation of a selected item. Apart from this, MultiViewAdapter adds many other useful features into the library as add-ons. This class is used to create a swipe to delete the items of RecyclerView. RecyclerView is the upgrade of ListView. If you are still having issues with a recent version of the support library, I would suggest reviewing your calls to notifyXXX (specifically, your use of notifyDataSetChanged) inside your adapter, to make sure you are adhering to the (somewhat delicate/obscure) RecyclerView. A CardView also a view group. Files we need for this app are shown in the image below. Reply Delete. Membuat adapter 4. Recycler View allows to display thousands rows data with optimized memory usage. Adapter This class is a generic way of backing an RecyclerView with a Firebase location. A RecyclerView with multiple item types. How To Add RecyclerView Using Kotlin? Now we have to create a new Kotlin file to create our Custom Adapter. Cheer up and come to my free training. See this guide for more information. Today I want to share the best Android SearchBar library that I’ve seen. ListAdapter is a new class bundled in the 27. gradle file. Adapter을 통한 View을 구성할 수 있다. Please feel free to use this. Adapter that makes your life easy! View on GitHub. Support Library is a library for components and other very helpful classes, provided by Google, that enables us to work with modern components, and components that were added later in Android Development. I use inline mocking to mock RecyclerView. If you continue browsing the site, you agree to the use of cookies on this website. Make your adapter able to receive a content list and create a method that returns a new adapter (in this case a ComposedAdapter). 0' } 💎 Note that we are not using the old support library com. Like large or unlimited number of data items is loaded and displayed in pages in web applications, chunks of data can be loaded and displayed in recycler view using paging library in android. This post is covered below topics. Animate addition and removal of ItemAnimator; Appearance animations for items in RecyclerView. For this reason, we need to pass an instance of what LayoutManager is being used to collect the necessary information to ascertain when. Jadi sebelum kita menerapkan adapter, kita harus terlebih dulu menge-set LinearLayoutManagernya. Add Navigation to SavedRestaurantListActivity. You will use a vertical LinearLayoutManager. We have collection of more than 1 Million open source products ranging from Enterprise product to small libraries in all platforms. A Library for make an easy and faster RecyclerView without adapter Recycling is Easy, No Adapter ! Make easy and faster RecyclerView without adapter, design for kotlin. adapter = movieListAdapter. * RecyclerView can perform several optimizations if it can know in advance that changes in * adapter content cannot change the size of the RecyclerView itself. Android Retrofit Library is type safe HTTP client for android and java, developed by Square Inc. RecyclerView animations. So say good bye to things like SimpleCursorAdapter, ArrayAdapter and the like. support:recyclerview-v7:28. We then set the adapter on our RecyclerView. In this Android RecyclerView Tutorial for simplicity I will be using a LinearLayoutManager for displaying a vertical list of items. We will build an app that displays a list of hard-coded instances of class Link in a RecyclerView. You can combine TextViews, Buttons, ImageViews or any other UI elements and display them. The AdapterDelegates library also provides a base class ListDelegationAdapter that already puts together RecyclerView. You need to add the following support library graddle dependency to project build. Whenever we need to refresh the content's of a view via a vertical swipe gesture we use Pull To Refresh. 3 Create Adapter For RecyclerView. I am trying to get a recycler viewer with a cursor adapter. Adapter connects your data to the. Note that the key here is the LayoutManager. In this tutorial, we show you, using code examples, how you can add Header to RecyclerView in your Android code. Learn how to use pull to refresh aka SwipeRefreshLayout in Android Studio with example using ListView and RecyclerView. if you are adding custom adapter to. Our First Step Is Creating Server Side Php Script And Next Step Creating Android Project. Using Data Binding on RecyclerView is very simple and clean. RecyclerView. The RecyclerView is one of the most used widgets in the Android world, and with it you have to implement an Adapter which provides the items for the view. Create a custom adapter for recyclerview. Adapun langkah untuk membuat RecyclerView adalah: 1. JSON stands for JavaScript Object Notation. But creating adapters with multiple view types is always exhausting. In RecyclerView. I don't like too much the way that you need to setup (create a bunch of files) just to have a list in your app (I've iOS background so thats my reference point) and this library does so much easier the development. public abstract class FirebaseRecyclerViewAdapter extends android. This tutorial will cover adding sticky headers to your existing implementation in just a few lines using qiujayen’s Sticky-LayoutManager library. Layout for RecyclerView items. RecyclerView. Support Library is a library for components and other very helpful classes, provided by Google, that enables us to work with modern components, and components that were added later in Android Development. In Android, RecyclerView is an advanced and flexible version of ListView and GridView. Android Swipe to Delete RecyclerView items with UNDU. It is more than just a convenience library. A class extending RecyclerView. You retain control over the visual presentation of a selected item. SwipeRefreshLayout with ListView (deprecated). Simply said: when a view goes out of visible area it is kept for recycling. He shows how to define an SQLite database with the Room library, display a list of data with the. Recyclerview becoming one of the most useful component of android applications. As simple as that is to implement a RecyclerView Adapter in Kotlin. Here we inflate the layout for each item of the horizontal RecyclerView and set data to each view. Apart from this, MultiViewAdapter adds many other useful features into the library as add-ons. These days of struggling to remember the correct pattern (and copy and paste the code from adapter to adapter) are now over, thanks to the introduction of Android's RecyclerView. In a RecyclerView, the adapter connects data with View items. In this article I show you a simple method to bind data to a RecyclerView in XML. Annotate fields with @BindView and a view ID for Butter Knife to find and automatically cast the corresponding view in your layout. There is no such XML property, that binds data to a RecyclerView. Instead of creating and binding Views, your RecyclerView. For example, when a new page is loaded, the PagedListAdapter signals the RecyclerView that the data has arrived; this lets the RecyclerView replace. Adapter and stands behind the UI. RecyclerView provides layout managers for positioning items. Review this guide for more information. Anyway, Android RecyclerView extends this concept and improves the way this adapter is used to increase overall performances. A Library for make an easy and faster RecyclerView without adapter Recycling is Easy, No Adapter ! Make easy and faster RecyclerView without adapter, design for kotlin. It's coming with default animations. An example of simple music app is explained which displays albums covers in grid view using CardView and RycyclerView. RecyclerView. You can combine TextViews, Buttons, ImageViews or any other UI elements and display them. An adapter manages the data model and adapts it to the individual entries in the widget. java, which extends the T type View of RecyclerView. recycling:recycling:${latest}" For paged adapter. RecyclerView with Data Binding Library. Gencycler uses annotation processing to analyze your code and generates the Recyclerview adapter for you, which means you only need to worry about your logic and not about the adapter. GitHub Gist: instantly share code, notes, and snippets. Till now, we have done some basic setups to use android retrofit library with recyclerView. The RecyclerView. com/packages/ongakuer/maven/CircleIndicator/images/download. When the activity is destroyed, we need to call cleanup() on the adapter so that it can stop listening for changes in the Firebase database. Expandable RecyclerView is one of the most important feature in Android which can be easily created for our application using Big Nerd Ranch’s Expandable RecyclerView Library It contains two views one is parent view and other is child view. Adapun langkah untuk membuat RecyclerView adalah: 1. Adapter have its bindings incorrect. Modify layout file of item views. Adapter, where we add a ViewHolder as an inner class and implement onCreateViewHolder, onBindViewHolder and getItemCount to inflate it and populate it with data. So it was sort of experimental. Support Library is a library for components and other very helpful classes, provided by Google, that enables us to work with modern components, and components that were added later in Android Development. The CardView add into Activity using XML file. Since there’s not so much of resources and. Take my code! Recycler view of android support library contains some call back method for scrolling event. Set adapter to RecyclerView; Show images using Glide library; So let's jump into the tutorial 🙂 Here is what the result we get when we call getquotes. Example Java File Structure. Parent is visible by default but the child view has to be. Recycling is Easy, No Adapter ! Make easy and faster RecyclerView without adapter, design for kotlin. Moving to PagedListAdapter. MultiViewAdapter - Recyclerview Adapter library to create composable view holders #opensource. Since there's not so much of resources and. Adapter implementation which supports any kind of items and has useful data operating APIs such as remove,add,etc. This new component is a big step because the ListView is one of the most used UI widgets. There is no such XML property, that binds data to a RecyclerView. Retrofit library is useful to make http calls seamlessly and it also saves. RecyclerView’s magic resides in its Adapter. At least in their current incarnation. Then set this method to your recyclerView. In the below example code I have described how to add Header in RecyclerView without using any external library. Getting started will guide you through steps for creating a basic recyclerview adapter. ArrayAdapter for RecyclerView. In this tutorial, we are going to learn how to render a simple RecyclerView with a custom layout. I don't like too much the way that you need to setup (create a bunch of files) just to have a list in your app (I've iOS background so thats my reference point) and this library does so much easier the development. Hello guys, I've ran on a bug, some methods in RecyclerView. An adapter. Made to simplify and enhance the use of the RecyclerView's Adapter OneAdapter is made to simplify and enhance the use of the RecyclerView's Adapter while preventing common mistakes. We can safely say that almost 90% of the android apps out there uses recyclerview. Based on the SortedList: Uses a Comparator to sort the elements in your RecyclerView. This new component is a big step because the ListView is one of the most used UI widgets. Below is a step by step source code on how to update RecyclerView adapter data with notifyDatasetChanged()method in android. Very simple use android recyclerView adapter and endlessScrolled in android support library recyclerView. Expandable RecyclerView is one of the most important feature in Android which can be easily created for our application using Big Nerd Ranch’s Expandable RecyclerView Library It contains two views one is parent view and other is child view. +' compile 'com. I've named it MyAndroidAdapter. 0' } 💎 Note that we are not using the old support library com. ListAdapter keeps track of the list for you and notifies the adapter when the list is updated. Writing the Adapter Class. The OnCreate method of MainActivity initializes this layout, instantiates the adapter, and prepares the underlying data source:. Each card will represent a row in the RecyclerView. Please feel free to use this. xml layout and here I have added a TextView. A RecyclerView is a great a way to show a large list of UI elements in an efficient way. Source download: Android-Multi-List Project Rxjava+Rtrofit+Recyclerview+Glide+Adapter Encapsulation Well, the encapsulation of the network layer of the Android-multi-list project (Rxjava+Rtrofit+Recyclerview+Glide+Adapter package) is over. It's also possible to use data binding within your RecyclerView Adapter. And an adapter is an extension of RecyclerView. Data model public class Item { private String name; public String getName() { return name; } }. The exception itself is: java. The adapter is a class that extends RecyclerView. Here we inflate the layout for each item of the horizontal RecyclerView and set data to each view. It help to deal with cursor and RecyclerView Adapter implementation. java to parse and show the data in RecyclerView in android. support:recyclerview-v7:26. Note: Read below steps very carefully to add CardView library inside your current project. But when the app is first installed and run, the user is confronted with a vast expanse of nothingness. In this course, Android Fundamentals: Views and Adapters you'll understand how to implement Adapters for various use case scenarios. And finally refactoring the adapter and the ViewHolder to handle it. Adapter base class for presenting List data in a RecyclerView, including computing diffs between Lists on a background thread. Android Recyclerview in the advanced version of the listview. In this android programming source code example, we are going to explore how to update RecyclerView adapter data with notifyDatasetChanged()method. Note that you must use the fully-qualified name android. The CardViews will make up a single view item in our recyclerview. dependencies {implementation 'com. In RecyclerView we only use RecyclerView. That's true. RecyclerView animations. This library is well documented, have nice architecture and good method names. RecyclerView, Adapter, and ViewHolder Now, you want CrimeListFragment to display a list of crimes to the user. We then set the adapter on our RecyclerView. In this course we will learn about the popular Android component called RecyclerView to display and interact with a list of items. The layout setup is identical to the previous one but in this case, we should have an item layout that defines the necessary variables in the data element. After adding the RecyclerView widget, let's start writing the adapter class to render the data. Explanations: We've created an Adapter, GithubUserAdapter, inheriting from RecyclerView. ) words 패키지 아래에 "WordListAdapter. Each one of these new features, give a platform to developers for implementing a highly custom made RecyclerView. Because of this, it's crucial that we implement it properly so our code strikes a good balance between being as optimized and concise as possible. databinding. Let’s break down how it simplifies use of the recycler adapters. Each card will represent a row in the RecyclerView. How To Add RecyclerView Using Kotlin? Now we have to create a new Kotlin file to create our Custom Adapter. This layout could be vertical, horizontal, or a grid. The adapter is a class that extends RecyclerView. Adapter that presents data from a PagedList. Adapter and BaseAdapter have one concept in common: the count of data items. This is a fairly flexible library where it allows creating, modifying, inspecting, and monitoring changes to items in a RecyclerView list. Adapter, the public int method that returns item count is called getItemCount(). It is an improvement on both of them and can be found in the latest v-7 support packages. RecyclerView Animators RecyclerView Animators is an Android library that allows developers to easily create RecyclerView with animations. dependencies {implementation 'com. You retain control over the visual presentation of a selected item. Discussion in 'Additional libraries, A new adapter which could be used to add multiple adapter in recyclerview. It makes image loading easier. Applying the Binding Collection Adapter library in your project is straightforward. RecyclerView. RecyclerView and a few other elements are a part of an external library so we must add this external library called Support Library. Android RecyclerView Using JSon Parsing PHP MySQL Data Admin January 25, 2017 April 18, 2017 Android Android RecyclerView is the advance version of android simple ListView. A RecyclerView with multiple item types. If you dont know How to use room database read Room database example tutorial. by Riyaz Ahamed Create Android Recyclerview adapters like a boss with MultiViewAdapter Library for creating composable recyclerview adaptersRecyclerView is an important widget in the Android framework and a large percentage of the Android apps out there use it. Create a class named Movie. Implement RecyclerView In Android Implement Item Click Listener on RecyclerView Android. Recyclerview is one of the powerful widgets inside android framework. 1 (API level 7) and higher - good news if you need to support older versions of Android before Lollipop. ArrayAdapter is now a library * Simple adapter implementation analog to. How to create Create AlertDialog With Custom Layout (Kotlin)? DESCRIPTION This tutorial will show how to create and show an AlertDialog with Custom Layout containing views such as EditTexts and Buttons etc. Menambahkan data pada recyclerview diperlukan LinearLayoutManager yang diperlukan oleh RecyclerView untuk mengatur setiap item (child) pada listnya. simple basic learning code. Adapter ,If you are not familiar with Recyclerview check our Recyclerview tutorial. Adapter for providing views that represent items in a data set. We aggregate information from all open source repositories. Explanations: We've created an Adapter, GithubUserAdapter, inheriting from RecyclerView. gradle file. Android RecyclerView does not have a default way to group items together. You can write one adapter for all the RecycleViews in your app and use it to render all the common design patterns. ) words 패키지 아래에 "WordListAdapter. If you want to use a RecyclerView, you will need to feel comfortable with three elements: - RecyclerView. After that use on CreateViewHolder link the adapter. In this video we will integrate everything we learned about RecyclerView, Volley, GSON and Glide. The following are top voted examples for showing how to use android. SearchesAdapter. Object p0) method is never called in a instance. See this guide for more information. Once your lists are using RecyclerView, the next step is to change your adapters to inherit from the ListAdapter class instead of the RecyclerView. Set adapter to RecyclerView; Show images using Glide library; So let's jump into the tutorial 🙂 Here is what the result we get when we call getquotes. The problem: RecyclerView is awesome but it doesn't scale well for nested and complex list views. If there is a functional requirement in your application that needs list of items to be displayed in UI and allow user to choose multiple items from it, then read this post which explains how to implement the feature using RecyclerView and CheckBox. You can check it here. Now let’s wrap it all together in the main RecyclerView adapter: CourseRVAdapter. With Safari, you learn the way you learn best. It helps us to load data gradually and gracefully in our application's RecyclerView. Countdown And Liftoff: Hooking up the Adapter And RecyclerView This is the moment you’ve been waiting for, the final stage before blast off! All you need to do is hook your adapter up to your RecyclerView and make sure it retrieves photos when it’s created so you can explore space — in pictures. RecyclerView. java and declare title, genre and year. Menampilkan data di RecyclerView dari Database MySQL di Android Studio menggunakan Library Volley - Mr Brohid -- Hello Guys, Selamat datang lagi di blog Mr Brohid untuk kali ini, saya ingin berbagi pengetahuan tentang Menampilan Data di RecyclerView dari Database MySQL di Android Studio menggunakan Library Volley, di artikel ini Anda dapat belajar tentang cara menampilkan data dari database ke. The Binding Collection Adapter library. When the displayed items change, you can notify the adapter by calling an appropriate RecyclerView. Adapter as of now we have to make a custom implementation to supply data to the adapter. Adapter that we need to override. In these Post we will create Recyclerview with header and footer android example application. Adapter methods with AdapterDelegatesManager methods so that you can reduce the amount of writing boilerplate code even more:. Volley is an HTTP library that makes networking request response for Android apps easier and faster. Android Support Library com. support:recyclerview-v7:24. In this video we will integrate everything we learned about RecyclerView, Volley, GSON and Glide. Using with Paging Library. It’s new, efficient and highly customisable, no wonder everyone wants to make the switch. Android: RecyclerView cannot be resolved to a type. activity_main. It acts as an intermediary between the data and the View. In this tutorial, we are going to learn how to render a simple RecyclerView with a custom layout. Create a RecyclerView. Adapter that replaces the old. Clean uses; Ability add custom layout in progress pagination and default layout; Support linear, Grid, StaggeredGrid LayoutManger for endless and show layout progressView; screenShot: gradle :. The following is a tutorial on how I like to implement the RecyclerView, Adapter, and ViewHolder pattern. Adapter as shown in a previous post Create a List with RecyclerView. The layout setup is identical to the previous one but in this case, we should have an item layout that defines the necessary variables in the data element. The Expandable RecyclerView library is a lightweight library that simplifies the inclusion of expandable dropdown rows in your RecyclerView. Adapter Item Click Listener On RecyclerView - The RecyclerView is more advanced of ListView. In part 4 we're going to look at implementing them with RecyclerView, a popular use case with apps that have Shared Element Transitions. Facebook explains this library as: Rebound spring models can be used to create animations that feel natural by introducing real world physics to your application. RecyclerView Animators is an Android library that allows developers to easily create RecyclerView with animations. Introducing Expandable RecyclerView: an open source library for expanding and collapsing groups using RecyclerView. Library Hours Holiday Hours, Monday 10/14. support library v22. Change numerous for brief RecyclerView has never been so easy. gradle: dependencies { implementation 'androidx. Discussion in 'Additional libraries, A new adapter which could be used to add multiple adapter in recyclerview. So, new-> Java class and name it RecyclerViewAdapter. I will tell you everything you need to learn about how to create your own Android Apps in Kotlin from scratch. We need an Adapter, what will get the list of items from a data source. Step 2 − Open build. In this tutorial, we are going to learn how to render a simple RecyclerView with a custom layout. OnViewAttachedToWindow(Java. So here is the complete step by step tutorial for Android simple RecyclerView Example Tutorial with TextView Android Studio. Recycler View allows to display thousands rows data with optimized memory usage. The library helps you create a cache of your app’s data on a device that’s running your app. gradle file for your app module: dependencies { implementation 'androidx. Moving to RecyclerView may also require changing how click handling is performed. For this we first prepare the XML layout for the single CardView rows and then create a RecyclerView. It extends the RecyclerView. A CardView also a view group. Change numerous for brief RecyclerView has never been so easy. Whenever we need to refresh the content's of a view via a vertical swipe gesture we use Pull To Refresh. We then set the adapter on our RecyclerView. You can combine TextViews, Buttons, ImageViews or any other UI elements and display them. To use a RecyclerView in your project you need to import the following androidx dependency on the build. Adapter and it. The fact-checkers, whose work is more and more important for those who prefer facts over lies, police the line between fact and falsehood on a day-to-day basis, and do a great job. Today, my small contribution is to pass along a very good overview that reflects on one of Trump’s favorite overarching falsehoods. Namely: Trump describes an America in which everything was going down the tubes under  Obama, which is why we needed Trump to make America great again. And he claims that this project has come to fruition, with America setting records for prosperity under his leadership and guidance. “Obama bad; Trump good” is pretty much his analysis in all areas and measurement of U.S. activity, especially economically. Even if this were true, it would reflect poorly on Trump’s character, but it has the added problem of being false, a big lie made up of many small ones. Personally, I don’t assume that all economic measurements directly reflect the leadership of whoever occupies the Oval Office, nor am I smart enough to figure out what causes what in the economy. But the idea that presidents get the credit or the blame for the economy during their tenure is a political fact of life. Trump, in his adorable, immodest mendacity, not only claims credit for everything good that happens in the economy, but tells people, literally and specifically, that they have to vote for him even if they hate him, because without his guidance, their 401(k) accounts “will go down the tubes.” That would be offensive even if it were true, but it is utterly false. The stock market has been on a 10-year run of steady gains that began in 2009, the year Barack Obama was inaugurated. But why would anyone care about that? It’s only an unarguable, stubborn fact. Still, speaking of facts, there are so many measurements and indicators of how the economy is doing, that those not committed to an honest investigation can find evidence for whatever they want to believe. Trump and his most committed followers want to believe that everything was terrible under Barack Obama and great under Trump. That’s baloney. Anyone who believes that believes something false. And a series of charts and graphs published Monday in the Washington Post and explained by Economics Correspondent Heather Long provides the data that tells the tale. The details are complicated. Click through to the link above and you’ll learn much. But the overview is pretty simply this: The U.S. economy had a major meltdown in the last year of the George W. Bush presidency. Again, I’m not smart enough to know how much of this was Bush’s “fault.” But he had been in office for six years when the trouble started. So, if it’s ever reasonable to hold a president accountable for the performance of the economy, the timeline is bad for Bush. GDP growth went negative. Job growth fell sharply and then went negative. Median household income shrank. The Dow Jones Industrial Average dropped by more than 5,000 points! U.S. manufacturing output plunged, as did average home values, as did average hourly wages, as did measures of consumer confidence and most other indicators of economic health. (Backup for that is contained in the Post piece I linked to above.) Barack Obama inherited that mess of falling numbers, which continued during his first year in office, 2009, as he put in place policies designed to turn it around. By 2010, Obama’s second year, pretty much all of the negative numbers had turned positive. By the time Obama was up for reelection in 2012, all of them were headed in the right direction, which is certainly among the reasons voters gave him a second term by a solid (not landslide) margin. Basically, all of those good numbers continued throughout the second Obama term. The U.S. GDP, probably the single best measure of how the economy is doing, grew by 2.9 percent in 2015, which was Obama’s seventh year in office and was the best GDP growth number since before the crash of the late Bush years. GDP growth slowed to 1.6 percent in 2016, which may have been among the indicators that supported Trump’s campaign-year argument that everything was going to hell and only he could fix it. During the first year of Trump, GDP growth grew to 2.4 percent, which is decent but not great and anyway, a reasonable person would acknowledge that — to the degree that economic performance is to the credit or blame of the president — the performance in the first year of a new president is a mixture of the old and new policies. In Trump’s second year, 2018, the GDP grew 2.9 percent, equaling Obama’s best year, and so far in 2019, the growth rate has fallen to 2.1 percent, a mediocre number and a decline for which Trump presumably accepts no responsibility and blames either Nancy Pelosi, Ilhan Omar or, if he can swing it, Barack Obama. I suppose it’s natural for a president to want to take credit for everything good that happens on his (or someday her) watch, but not the blame for anything bad. Trump is more blatant about this than most. If we judge by his bad but remarkably steady approval ratings (today, according to the average maintained by 538.com, it’s 41.9 approval/ 53.7 disapproval) the pretty-good economy is not winning him new supporters, nor is his constant exaggeration of his accomplishments costing him many old ones). I already offered it above, but the full Washington Post workup of these numbers, and commentary/explanation by economics correspondent Heather Long, are here. On a related matter, if you care about what used to be called fiscal conservatism, which is the belief that federal debt and deficit matter, here’s a New York Times analysis, based on Congressional Budget Office data, suggesting that the annual budget deficit (that’s the amount the government borrows every year reflecting that amount by which federal spending exceeds revenues) which fell steadily during the Obama years, from a peak of $1.4 trillion at the beginning of the Obama administration, to $585 billion in 2016 (Obama’s last year in office), will be back up to $960 billion this fiscal year, and back over $1 trillion in 2020. (Here’s the New York Times piece detailing those numbers.) Trump is currently floating various tax cuts for the rich and the poor that will presumably worsen those projections, if passed. As the Times piece reported: