Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Scratch Files in Android Studio?

Recently I came across a cool feature in Android Studio called scratch files. Just wanted to share it in Q and A Style.

What are scratch files and how to use them?

like image 574
mayank1513 Avatar asked Dec 10 '18 17:12

mayank1513


People also ask

What is a scratch file in Android Studio?

What Is Scratch File? A temporary source file. Scratch file isn't considered as a part of our projects and won't be stored in the workspace of the current project. Scratch files are stored in the directory where the android studio is installed on your machine under the `scratches` directory.

How do you use scratch files?

Create a scratch fileFrom the main menu, select File | New | Scratch File or press Ctrl+Alt+Shift+Insert . Select the language of the scratch file. Scratch files of the same type are automatically numbered and added to the Scratches and Consoles directory of the Project view. in the gutter or press Shift+F10 .

What are scratch files?

A scratch file is a temporary computer file which you use as a work area or as a store while a program is operating.


1 Answers

It's a cool feature that lets you save your code that you want to look at later or just for reference.

See this post

Say you are creating a class and you decide to change a section of code. You can create a new scratch file by right clicking on the navigation bar and selection New, and then scratch file. Copy and save the code in the scratch file. This file is not a part of your android studio project.

You can find this file under scratches scope or Scratches folder under Scratches and Consoles folder in Project Scope.

Hope this will interest you guys and help speeding up development.

like image 134
mayank1513 Avatar answered Oct 19 '22 17:10

mayank1513