Android Studio Logcat and Recycler View

Android Studio Logcat and Recycler View

Android Studio Logcat and Recycler View. Do you want to work on the android studio logcat and the recycler view? This article will deal with all about that. This is your one-stop to get all the knowledge about the android logcat. Keep reading.

Android Studio Logcat

We will start this article with the Android studio logcat. The first question is, “what is an android studio logcat?”

Logcat is one of the most needed part of android app development. It shows all the logs  log. But what kind of log. It shows the logs related to all the crashes the app goes through, any error in the code, etc. The logs come from the emulator or your device on which you are using the app.

Mainly three kinds of messages popup in logcat:

  • System.out.println
  • exceptions
  • android.util.Log

android.util.Log is used to properly log the errors on the application. All the log has some level. These levels tell how severe the Error is. Using the android.util.log you can filter all the errors based on the levels. Some of the example of the log level:

Log.v(“TAG”, “Verbose level message”);

Log.d(“TAG”, “Debug level message”);

Log.i(“TAG”, “Information level message”);

Log.w(“TAG”, “Warning level message”);

Log.e(“TAG”, “Error level message”);“TAG”, “Assert level message”);

How to start the logcat window?

There are several ways to open the log cat window. We will see some of them.

The first way is by just pressing Alt+F6 on the keyboard when you press the combination of these two keys; the logcat window automatically opens.

The second way is by using the menu bar. First of all, click the view button, then click on the tools window, then click on the logcat option. This method will also open the logcat window.

Android Studio Logcat
Android Studio Logcat

The third way is by using the bottom panel of the android studio. To use this method, just click on the Logcat tool button.

Android Studio Logcat and Recycler View.
Android Studio Logcat and Recycler View.

Logcat window

Android Studio Logcat
Android Studio Logcat and Recycler View.

The logcat window has mainly five types of options. We will see them one by one.

The first is the device selection menu. This menu allows you to select the device from the list of your devices on which you want to work on or from which you want to get the logs.

See also  Android is upgrading optimizing app stuck

The second is the app selection menu. This menu gives you the option to select between the multiple apps you are working on.

The third is the filter menu. This menu allows you to filter your logs on the basis of the level. It means that the log which has more severity will show on the top.

The fourth is the search. It helps you in searching for the log using some specific search keyword. This thing comes handy when you know what log you want to see.

The fifth is the “show only selected application.” If this option is activated, then you can only see the logs coming from that particular app. If you don’t select this option, it will show all the logs coming from that device.

Logcat levels

There is mainly 6 kind of filter in android studio.  A developer can make their own level. We will talk about creating our own level later.

  1. The first level is Verbose. The verbose is the least severe level of all. It shows all the logs from the app without filtering the logs on any severity.
  2. The second is the Debug. This is the one next level of severity. It shows only the logs relegated to the debug of the application. This gives the user an option to check only the information related to debugging.
  3. The third is Info. This shows all the informational logs related app. Information like the sensors are working or not; the app is connected to the internet or not and much other information.
  4. The fourth is the Warn. The warn shows all the warnings in the app. Warnings are related to those statements which may cause errors in the future.
  5. The fifth one is Error. The Error shows all the errors related to the application. This shows the possible problem in the application.
  6. The last one is the Assert. The Assert shows the logs of the issues which should never happen in the first place. This is the highest severity in the android studio. These are those issues that will cause a big problem for the application.

Making your own level

As we talked earlier that we can create our personal level in the logcat. Here we are going to know about that. Each and every log in android studio uses a tag. By using those tags, we can create our own level. This thing comes handy when you want to trace back the log by your own filter. To create your own level, follow these steps.

See also  Android system recovery || How to Boot and Customize Device
Making your own level Logcat
Android Studio Logcat and Recycler View.

Step 1. Click on the show selected application option. A menu will appear.

Step 2. Select the “edit filter configuration” option. It will take you to a new window, where you will be able to create a new filter.

Step 3. Enter all the variables correctly and hit ok. It will generate a new level/filter for the developer.

Options to fill over there

  • Filter Name: This field will take the input of the name of the filter you want. Make sure to keep it unique.
  • Log tag: This is the most needed option. This will help you to identify which type of message you want to filter using this new filter. Choose your tag correctly.
  • Log message. This option tells you the message you want to see in the log. Create your message which defines the circumstances clearly, so that the other user can understand it also.
  • Package name: This is an optional function. This is used if you want to get logs from a certain app if you want, so then enter the name of the package of the application.
  • PID: PID stands for process id. This will help you to log a specific process. If you want to log from a specific process, then enter the process id else leave it blank.

As of now, we know everything about the Logcat. Now we will see how to clean the logcat window. Cleaning the logcat window is very simple. You just have to click the trash button on the side of the logcat window, and your logcat window will be clean.

logcat window

Android Studio Recycler View

Android Studio Recycler view is an option to create a list in the android application. It is much better than the list view. It is a moreover dynamic kind of list which keeps changes from time to time. The list we have seen the food ordering apps are made from recycler view. As the food menu keep changing, we use this method.

There is a lot of optimization in the recycler view than the list view.

Android Studio Recycler View
Android Studio Recycler View

How to use Recycler View?

To use the recycler view, we need to add the recycler view library, which is V7 support libraries. To import the follow the steps.

Step 1. Open your application and head to build.gradle file.

See also  What is android easter eggs?

Step 2. Insert the following code in the dependencies section.

dependencies {

implementation ‘’


Now once you have added the library to your project, you can now add the recycler view to your layout. To add the in your layout, insert this code in your in-project code section. This code refers to this is the only thing in the layout.
<?xml version=”1.0″ encoding=”utf-8″?>

<!– A RecyclerView with some commonly used attributes –>






Now once you have inserted this code, you have to connect the recycler view to the layout manager, and you also have to add the adapter to display the data. Insert this code to do so.

Read my other post: Infinity Blade on Android

For Java

public class MyActivity extends Activity {

private RecyclerView recyclerView;

private RecyclerView.Adapter mAdapter;

private RecyclerView.LayoutManager layoutManager;


protected void onCreate(Bundle savedInstanceState) {



recyclerView = (RecyclerView) findViewById(;

// use this setting to improve performance if you know that changes

// in the content do not change the layout size of the RecyclerView


// use a linear layout manager

layoutManager = new LinearLayoutManager(this);


// specify an adapter (see also next example)

mAdapter = new MyAdapter(myDataset);



// …


For Kotlin

class MyActivity : Activity() {

private lateinit var recyclerView: RecyclerView

private lateinit var viewAdapter: RecyclerView.Adapter<*>

private lateinit var viewManager: RecyclerView.LayoutManager

override fun onCreate(savedInstanceState: Bundle?) {



viewManager = LinearLayoutManager(this)

viewAdapter = MyAdapter(myDataset)

recyclerView = findViewById<RecyclerView>( {

// use this setting to improve performance if you know that changes

// in the content do not change the layout size of the RecyclerView


// use a linear layout manager

layoutManager = viewManager

// specify an viewAdapter (see also next example)

adapter = viewAdapter



// …


Now you can insert your code to do your project. That’s all for recycler view

Read More: What is Google pinyin input?


Android Studio Logcat and Recycler View. We have seen how to access the logcat and how to work with the recycler view in the android studio. Try on your projects. I hope you like the post.