Android Archives - Learn Smart Coding https://blogs.learnsmartcoding.com/category/android/ Everyone can code! Sat, 09 Jan 2021 21:02:27 +0000 en-US hourly 1 https://wordpress.org/?v=6.6.1 209870635 Kotlin Tutorial: Basics learning on operators and types | Kotlin programming language | Part 1 https://blogs.learnsmartcoding.com/2021/01/09/kotlin-tutorial-basics-learning-on-operators-and-type/ https://blogs.learnsmartcoding.com/2021/01/09/kotlin-tutorial-basics-learning-on-operators-and-type/#respond Sat, 09 Jan 2021 21:02:27 +0000 https://karthiktechblog.com/?p=779 Introduction In this Kotlin Tutorial: Basics learning on operators and types, you will learn about operators and types in the Kotlin programming language. In this part, we will explore numeric operators, usage of variables, types, and learn about strings. You will get the full benefits when you go through the tutorial in sequence. Reference on […]

The post Kotlin Tutorial: Basics learning on operators and types | Kotlin programming language | Part 1 appeared first on Learn Smart Coding.

]]>
Introduction

In this Kotlin Tutorial: Basics learning on operators and types, you will learn about operators and types in the Kotlin programming language. In this part, we will explore numeric operators, usage of variables, types, and learn about strings.

You will get the full benefits when you go through the tutorial in sequence. Reference on Kotlin Basics.

Related Post:

Prerequisite

You should be familiar with:

  • How to create a project using IntelliJ IDEA
  • How to work with the Kotlin REPL (Read-Eval-Print Loop) interactive shell.

Learn on how to install IntelliJ IDEA IDE and create project.

What you’ll learn

  • Learn about operators and types.
  • Practice with sample example

Kotlin Basics: Operators and Types

In Kotlin programming language, we will look at the operators and types with examples for better understanding.

  1. Open IntelliJ IDEA.
  2. Select Tools > Kotlin > Kotlin REPL and open the console.

Numeric operators

Like other programming languages, a numeric operator like +, -, *, and / are for plus, minus, multiplication, and division used by Kotlin. Kotlin also supports numeric types like Byte, Short, Int, Double, Long, Float.

kotlin numeric types

Good to know:

If a variable initialized value is more than Int then the type is Long. To specify the Long value explicitly, append the suffix L to the value.

Examples:

Enter the following expressions in the REPL. To see the result, press Control+Enter (Command+Enter on a Mac) after each one.  indicates output from your code.

Now, let’s try different expressions for integer and double.

Kotlin Tutorial: Basics learning on operators and types

Now, let’s call some methods on the numbers. Kotlin keeps numbers as primitives, but it lets you call methods on numbers as if they were objects.

Underscore usage on numbers

You can use underscores to make number constants more readable.

val oneThousand = 1_000
val oneHundredThousand = 1_00_000
val oneMillion = 1_000_000
val creditCardNumber = 9874_5487_5552_1154L
val socialSecurityNumber = 999_99_9999L
val hexBytes = 0xFF_EC_DE_5E
val bytes = 0b11010010_01101001_10010100_10010010

Usage of Types

In Kotlin, there is no implicit conversion in Kotlin, meaning a Int the variable cannot be assigned to the variable directly. You can always assign values of different types by casting.

Let’s take a look at some examples. Declare variable with Int type and try to assign the value to a different variable type.

operators and types | Kotlin programming language
operators and types | Kotlin programming language

Variable Types

There are two types of variable in Kotlin which are var and val. With var, you can assign a value, then change the value later in the program. With, you can assign a value once. If you try to assign something again, you get an error.

var num = 1
 num = 4
 val pi = 3.14
 pi= 6.28 // this will throw error
val and var example in kotlin programming language

About Strings

Strings works almost same as other language. using " for strings and ' for single characters, and you can concatenate strings with the + operator.

var animalName = "lion" + " tiger"
println(animalName)
lion tiger //this is the output

Create a string template with an expression in it. As in other languages, the value can be the result of an expression. Use curly braces {} to define the expression.

 val i = 5
 val j = 2
 var animalName = "There are ${i} lions" + " and ${j} tigers in this zoo"
 println(animalName)
There are 5 lions and 2 tigers in this zoo // output

usage of string in kotlin

Congratulations! Kotlin Tutorial: Basics learning on operators and types part 1 is now completed.

Conclusion

In this post, you have learned about operators and types and various ways of using operators.

The post Kotlin Tutorial: Basics learning on operators and types | Kotlin programming language | Part 1 appeared first on Learn Smart Coding.

]]>
https://blogs.learnsmartcoding.com/2021/01/09/kotlin-tutorial-basics-learning-on-operators-and-type/feed/ 0 779
Kotlin Tutorial: Getting Started https://blogs.learnsmartcoding.com/2021/01/06/kotlin-tutorial-getting-started-using-kotlin-repl-read-eval-print-loop/ https://blogs.learnsmartcoding.com/2021/01/06/kotlin-tutorial-getting-started-using-kotlin-repl-read-eval-print-loop/#respond Wed, 06 Jan 2021 04:57:46 +0000 https://karthiktechblog.com/?p=768 Introduction Kotlin tutorial getting started using REPL (Read-Eval-Print Loop) teaches you Kotlin Programming language with simple examples. You will learn the advantage of programming in Kotlin and install the IDE to practice. This Kotlin tutorial is mainly for the programmers who already know an object-oriented language and want to learn more about Kotlin. If you […]

The post Kotlin Tutorial: Getting Started appeared first on Learn Smart Coding.

]]>
Introduction

Kotlin tutorial getting started using REPL (Read-Eval-Print Loop) teaches you Kotlin Programming language with simple examples. You will learn the advantage of programming in Kotlin and install the IDE to practice. This Kotlin tutorial is mainly for the programmers who already know an object-oriented language and want to learn more about Kotlin.

If you are from C# or Java programming background, great! You will know how much more concise and readable your code you can write using Kotlin.

About Kotlin

Kotlin language is around 2011 and made as open source from 2012. Kotlin is designed to help programmers to write robust code. For example, Kotlin distinguishes between nullable and non-nullable data types, which helps catch more errors at compile time.

Are you from Java background? Good news, Kotlin code compiles so that you can use Java and Kotlin code side-by-side, and continue to use your favorite Java libraries.

Prerequisite

You should be familiar with:

  • The basics of a object-oriented programming language such as Java or C#.
  • Using an IDE such as IntelliJ IDEA, Android Studio, Eclipse, or Visual Studio.
  • How to declare variables, use types, program with classes, methods and handling exception.

What you’ll learn

  • How to work with the Kotlin REPL (Read-Eval-Print Loop) interactive shell

What you’ll do

  • Install the IntelliJ IDEA and get familiar with some feature.

Install IntelliJ IDEA

Download and install IntelliJ IDEA

Download IntelliJ IDEA for your operating system. Select the right download file based on your operating system.

Use Community version for trying it free.

Verify your IntelliJ IDEA installation

  • Start IntelliJ IDEA.
  • Install any updates and additional content you are prompted for.

Create Hello World Kotlin

Create a Kotlin project to let IntelliJ IDEA know that you are working in Kotlin.

I have installed the IntelliJ IDEA version “IntelliJ IDEA Community Edition 2020.3 x64”.

Steps to follow

  • Create a new project from the IntelliJ IDEA welcome window.
  • From the New Project dialog, select Kotlin and provide the project name as “HelloWorld”.
  • Select the build system as “Gradle Kotlin” and choose an SDK from the project SDK. If you are doing it the first time.
  • Click finish.
Kotlin getting started REPL (Read-Eval-Print Loop)

You can now run the application by clicking on Run from top right. Also, now you have access to REPL, (Read-Eval-Print Loop), Kotlin’s interactive shell.

Select Tools > Kotlin > Kotlin REPL to open the REPL.

We have a simple program that prints “Hello World”.

 
fun helloWorld() {
     println("Hello World!")
 }
 
 helloWorld()

The fun keyword designates a function, followed by the name. As with other programming languages, the parentheses are for function arguments.

There is no return type because the function doesn’t return anything.

Click on Run button in the left side or by Control+Enter (Command+Enter on a Mac) to run it.

In Kotlin, no need to place semicolons at the end of lines.

Note: From Kotlin versions 1.3 and above, the main the function may or may not have a parameter of type Array<String>.

Kotlin getting started

Congratulations! You learned Kotlin tutorial getting started using REPL (Read-Eval-Print Loop). You have Installed the IntelliJ IDEA and got familiar with some features of IDE and Kotlin programming.

What’s next? Kotlin Basic

Conclusion

In this post, you have learnt how to install IntelliJ IDEA and how to work with the Kotlin REPL (Read-Eval-Print Loop) interactive shell. That’s all from this post. Next is to learn Kotlin Basics.

The post Kotlin Tutorial: Getting Started appeared first on Learn Smart Coding.

]]>
https://blogs.learnsmartcoding.com/2021/01/06/kotlin-tutorial-getting-started-using-kotlin-repl-read-eval-print-loop/feed/ 0 768
Implement a simple timer using CountDownTimer in Android using Kotlin or Java https://blogs.learnsmartcoding.com/2020/10/20/implement-a-simple-timer-using-countdowntimer-in-android-using-kotlin-or-java/ https://blogs.learnsmartcoding.com/2020/10/20/implement-a-simple-timer-using-countdowntimer-in-android-using-kotlin-or-java/#respond Tue, 20 Oct 2020 02:28:57 +0000 https://karthiktechblog.com/?p=751 In this post, I will be covering how to Implement a simple timer using CountDownTimer in Android using Kotlin or Java. Android provides a utility class called CountDownTimer that you use to implement the timer. Schedule a countdown until a time in the future, with regular notifications on intervals that are set. Implementing CountDownTimer in Kotlin Android […]

The post Implement a simple timer using CountDownTimer in Android using Kotlin or Java appeared first on Learn Smart Coding.

]]>
In this post, I will be covering how to Implement a simple timer using CountDownTimer in Android using Kotlin or Java.

Implement a simple timer using CountDownTimer in Android using Kotlin or Java

Android provides a utility class called CountDownTimer that you use to implement the timer.

Schedule a countdown until a time in the future, with regular notifications on intervals that are set.

Implementing CountDownTimer in Kotlin Android

Add a private variable called timer which is of type CountDownTimer

private val timer: CountDownTimer

Inside the init block, initialize and start the timer. Pass in the total time for future and interval to trigger the timer.

timer = object : CountDownTimer(60000, 1000) {
   override fun onTick(millisUntilFinished: Long) {       
   }
   override fun onFinish() {       
   }
}
timer.start()

Creates a timer with 60 seconds future with an interval of 1 second. Note that the time must be specified in milliseconds.

Implement the onTick() callback method, which is called on every interval or on every tick.

The onFinish() callback method is called when the timer is finished. The API reference for Kotlin is available at Android Reference. Java reference is available here.

Related Posts

Conclusion

In this post, I showed you how to implement a simple timer using CountDownTimer in Android using Kotlin or Java. If you have any questions or just want to chat with me, feel free to leave a comment below.

The post Implement a simple timer using CountDownTimer in Android using Kotlin or Java appeared first on Learn Smart Coding.

]]>
https://blogs.learnsmartcoding.com/2020/10/20/implement-a-simple-timer-using-countdowntimer-in-android-using-kotlin-or-java/feed/ 0 751
Android studio best 45 tips and tricks https://blogs.learnsmartcoding.com/2020/08/13/android-studio-best-45-tips-and-tricks-for-app-development/ https://blogs.learnsmartcoding.com/2020/08/13/android-studio-best-45-tips-and-tricks-for-app-development/#respond Thu, 13 Aug 2020 01:34:05 +0000 https://karthiktechblog.com/?p=671 This post covers Android studio best 45 tips and tricks that you should know as a app developer. To know more tips check my other page Android studio helpful tips and tricks that covers 20 helpful tips and tricks. Best Tips and Tricks 1. Code Completion Code Completion Ctrl+Space helps you quickly complete code statements. […]

The post Android studio best 45 tips and tricks appeared first on Learn Smart Coding.

]]>
This post covers Android studio best 45 tips and tricks that you should know as a app developer.

To know more tips check my other page Android studio helpful tips and tricks that covers 20 helpful tips and tricks.

Best Tips and Tricks

Android studio best 45 tips and tricks

1. Code Completion

Code Completion Ctrl+Space helps you quickly complete code statements. It works as you type and gives a list of suggestions available from the current caret position:

android studio tips Code Completion

2. Basic code completion

Basic code completion Ctrl+Space is available in the search field when you search for text in the current file Ctrl+F, so there is no need to type the entire string.

Basic code completion - android studio

3. When you use basic code completion Ctrl+Space, type any characters that exist anywhere in an identifier.

Android tips and tricks

4. Easy to specify colors in CSS files

The color properties have icons of the corresponding color in the editor gutter.

Click an icon to choose the desired color using the color picker.

Easy to specify colors in CSS files - Android studio

5. To select a part of your code, drag your mouse while pressing

To select a part of your code, drag your mouse while pressing - Android studio

6. You can comment and uncomment lines and blocks of code

: comment or uncomment the current line or the selected block with single line comments ( //… )
: enclose the selected block in a block comment ( // )

To uncomment a block, position the caret anywhere inside it and press Ctrl+Shift+/.

7. Easy to invoke the Commit Changes dialog

Press Ctrl+K to invoke the Commit Changes dialog.
It shows all modifications in a project, provides files’ status summary and suggests improvements before checking in.

8. Compare the following via context menu commands

  • directories
  • a class or a class member with another class or class member
  • a local file with its versions in Local History
  • a local file with its current revision in your version control repository
  • any two revisions of the same file
  • any local file with the file currently opened in the Editor
  • any two local files with each other: text or binary
  • active Editor with the clipboard contents
  • any text sources you paste into a blank diff window

You can configure the Diff tool of the Settings/Preferences dialog (Ctrl+Alt+S) under Tools | Diff & Merge.

9. You can create code constructs using statement completion

Start typing a method declaration, a method call, or a statement such as if, do-while, try-catch, or return.

Press Ctrl+Shift+Enter to complete the statement into a syntactically correct construct.

10. Quickly complete a method call

To quickly complete a method call of a static method located anywhere in your project, a library or a JDK, enter a prefix and press Ctrl+Space twice. You can press Alt+Enter to import the selected method.

android studio

11. Choose favorite shell

You can use your favorite shell from the built-in Terminal.
In the Settings/Preferences dialog (Ctrl+Alt+S), go to Tools | Terminal and specify the path to your shell executable.

12. How to fix a highlighted error or warning

Press Alt+Enter in the editor to fix a highlighted error or warning, improve or optimize a code construct.

fix a highlighted error or warning - android studio

13. Refactor

Use Refactor | Copy to create a class which is a copy of the selected class.

This is useful when you need to create a class similar to an existing one, and it’s not feasible to put shared functionality in a common superclass.

14. Copy Reference action

Use the Edit | Copy Reference action to insert a reference to a field/method/class/file into the current position in the editor.

Position the caret within the myMethod method name and press Ctrl+Alt+Shift+C:

To paste the reference, press Ctrl+V:

You can also copy references in the Go to Class/Go to Symbol/Go to File dialogs. Press Ctrl+C on any element in the lookup list.

15. Protect any files in your project by copyright

Do you want to protect any files in your project by copyright? Go to the Settings/Preferences dialog Ctrl+Alt+S, select Editor | Copyright | Copyright

Profiles, create a copyright profile, and add the relevant copyright variables.

For example, use $today.year to keep the copyright year up-to-date.

16. Referring to an Ant property or target

You can start referring to an Ant property or target even if it’s not defined yet. Press Alt+Enter and choose Create property from the list of intention actions to create the necessary tag without lieaving your current editing location.

17. Press Ctrl+D in the editor to duplicate the selected block, or the current line when no block is selected.

18. using Code Completion

When using Code Completion, you can select the first item by pressing Ctrl+..
IntelliJ IDEA Community will insert the selected item followed by a dot or -> depending on the current context.

19. Expand selection

To expand selection, press Ctrl+W. Each time you press Ctrl+W, the selection expands to other areas of code.

For example, the selection expands from a method name to the expression calling this method, then to the whole statement, then to the containing block, and so on.

20. Accept the current selection

You can accept the current selection in the code completion suggestions list with the period key (.), comma (,), semicolon (;), space, and some other characters.

21. You can open an external file for editing by dragging it from a file browser to the editor.

22. Dedicated editor

You can edit a language injection in your code using a dedicated editor.

For example, to edit a regular expression, start typing it, press Alt+Enter and choose Edit RegExp Fragment. The regular expression opens in a separate tab in the editor, where you can type backslashes as is.

All changes are synchronized with the original regular expression, and escape characters are presented automatically. When ready, press Escape to close the regular expression editor.

language injection in your code using a dedicated editor

23. EditorConfig

You can override IDE code style settings with settings from EditorConfig

To configure the style in EditorConfig, open settings (Ctrl+Alt+S), navigate to Editor | Code Style, and select the Enable EditorConfig support checkbox.

Click Export to export the current IDE code style settings into the .editconfig file.

override IDE code style settings with settings from EditorConfig

24. Jump to a file

You can jump to a file located in a deeply nested directory by pressing Ctrl+Shift+N and typing several characters of the enclosing directories and filename.

25. To evaluate any expression while debugging your program, select the expression in the editor and press Alt+F8

26. Ignore by indexing, inspection, and code completion

You can exclude any file from your project so that it is ignored by indexing, inspection, and code completion.

In the Project tool window, right-click the file you want to exclude and choose Mark as plain text from the context menu. If necessary, you can always revert the file to its original type by the Mark as the command.

27. Documentation page

To open your browser with the documentation page for the element at the caret, press Shift+F1 (View | External Documentation).

To use this feature, a browser must be selected on the Tools | Web Browsers page of the Settings/Preferences dialog (Ctrl+Alt+S)

28. Add project elements

Alt+Shift+F lets you add project elements (files, folders, packages, instance, and class members) into a Favorites list Alt+2, which also automatically adds your bookmarks and breakpoints:

29. You can drag an external file from Explorer or Finder and drop it onto the Favorites tool window Alt+2

30. Explore the structure of the currently opened file

To explore the structure of the currently opened file, press Ctrl+F12 or select View | Tool windows | Structure. File Structure shows all classes, functions, macros, and namespaces.

Double-click an element to jump back to the source code. To locate an element, start typing its name.

Explore the structure of the currently opened file

31. If you accept a completion suggestion by pressing the exclamation mark (!), this expression will be negated

32. Code Completion suggestion

When using Code Completion, you can accept the current selection in the suggestions list with Ctrl+Shift+Enter.

IntelliJ IDEA Community will not only insert the selected string, but also turn the current code construct into a syntactically correct one (balance parentheses, add missing braces and semicolons, and so on).

33. Documentation comment tags

If a method signature has been changed, IntelliJ IDEA Community highlights the documentation comment tags that ran out of sync and suggests a quick-fix:

34. Press Alt+1 to open the Project tool window and switch focus to it

35. To navigate to the implementations of an abstract method, position the caret at its usage or its name in the declaration and press Ctrl+Alt+B

36. Inheritance hierarchy for a selected class

To see the inheritance hierarchy for a selected class, press Ctrl+H (Navigate | Type Hierarchy). You can also invoke the hierarchy view directly from the editor to see the hierarchy for the currently edited class.

Inheritance hierarchy for a selected class

37. View all method

To view all methods of the implemented interfaces in a class, place the caret at the implements keyword in the class declaration and press Ctrl+Shift+F7:

38. View all exit points of a method

To view all exit points of a method, place the caret at one of them, for example, the return statement, and press Ctrl+Shift+F7:

39. View all statements for exception

You can view all statements within the method where certain exceptions can be caught. Place the caret at the throws statement and press Ctrl+Shift+F7

40. To scroll a file horizontally, turn the mouse wheel while keeping pressed.

41. To preview a referenced image in a popup instead of in a separate editor tab, press Ctrl+Shift+I.

42. Live template abbreviation

If you do not remember a live template abbreviation, press Ctrl+J to see a list of suggestions. For example, type it and press Ctrl+J to see what happens.

43. Run code analysis

Use Code | Inspect Code to run code analysis for the whole project or a custom scope and examine the results in a separate window.

44. Variable refactoring

The Extract Variable refactoring wraps the selected expression into a variable. It adds a new variable declaration and uses the expression as an initializer. To invoke this refactoring, select the expression and press Ctrl+Alt+V (Refactor | Extract | Variable):

45. You can use the Extract Variable refactoring even on incomplete statements. Press Ctrl+Alt+V and choose an expression.

Conclusion

In this post, I showed you various android studio tips and tricks that you can apply in your day to day programming. to read 20 more tips, view here. If you have any questions or just want to chat with me, feel free to leave a comment below.

The post Android studio best 45 tips and tricks appeared first on Learn Smart Coding.

]]>
https://blogs.learnsmartcoding.com/2020/08/13/android-studio-best-45-tips-and-tricks-for-app-development/feed/ 0 671
Android studio helpful tips and tricks https://blogs.learnsmartcoding.com/2020/08/12/android-studio-helpful-tips-and-tricks-to-speed-up-app-development/ https://blogs.learnsmartcoding.com/2020/08/12/android-studio-helpful-tips-and-tricks-to-speed-up-app-development/#comments Wed, 12 Aug 2020 02:47:02 +0000 https://karthiktechblog.com/?p=665 I would like to cover 65 Android studio helpful tips and tricks. Android Studio provides the fastest tools for building apps on every type of Android device. This post covers 20 useful tips and remaining 45 tips are covered in Android studio best 45 tips and tricks Tips and Tricks 1. Code Completion feature A […]

The post Android studio helpful tips and tricks appeared first on Learn Smart Coding.

]]>
I would like to cover 65 Android studio helpful tips and tricks. Android Studio provides the fastest tools for building apps on every type of Android device.

This post covers 20 useful tips and remaining 45 tips are covered in Android studio best 45 tips and tricks

Tips and Tricks

Android studio helpful tips and tricks

1. Code Completion feature

A special variant of the Code Completion feature invoked by pressing Ctrl+Space twice allows you to complete XML tag names from namespaces not declared in the current file. If the namespace is not declared yet the declaration is generated automatically.

Code Completion feature

2. Inject SQL into a string literal

You can inject SQL into a string literal (Alt+Enter | Inject language or reference | ) and then use coding assistance for SQL.

Inject SQL into a string literal

3. Create Kotlin file

Kotlin is a powerful, concise and expressive language crafted by JetBrains. Android Studio supports it out-of-the-box.

To create a Kotlin file, right-click the target folder, and choose the corresponding option on the New menu:

Create Kotlin file

4. Several Kotlin project types

Android Studio provides several Kotlin project types:

Android Studio provides several Kotlin project types

5. Call Java code from Kotlin easily

Android Studio allows you to easily call a Java code from Kotlin:

5. Android Studio allows you to easily call a Java code from Kotlin

6. Easily convert any Java class to the Kotlin one with the same semantics.

One can easily convert any Java class to the Kotlin one with the same semantics.

To do that, just choose Code | Convert Java File to Kotlin File on the main menu:

Easily convert any Java class to the Kotlin one with the same semantics

7. Automatically installs the package you’re trying to import

Intelli J IDEA Community provides a quick-fix that automatically installs the package you’re trying to import: if, after the import keyword, you type a name of a package that is not currently available on your machine, a quick-fix suggests to either ignore the unresolved reference or download and install the missing package.

8. Get access to the most common breakpoint actions and filters

Get access to the most common breakpoint actions and filters through intention actions (Alt+Enter)

Get access to the most common breakpoint actions and filters

9. Easily generate the getter and setter methods for any fields of your class

By using Alt+Insert (Code | Generate) in the editor, you can easily generate the getter and setter methods for any fields of your class.

Easily generate the getter and setter methods for any fields of your class

10. Antivirus protection

If you notice that IntelliJ IDEA Community works slowly, consider reducing the number of folders under antivirus protection. This may significantly improve performance.

11. Quickly enable/disable the breakpoints

Right-click a breakpoint marker in the gutter to quickly enable/disable the breakpoint or adjust its properties.

Quickly enable/disable the breakpoints

12. You can narrow down the list of code completion suggestions by using camel case prefixes.

You can narrow down the list of code completion suggestions by using camel case prefixes.

13. use “CamelHumps”

When you search for a class, file, or symbol press and use “CamelHumps” names to filter the list of results:

14. Show suggestions

When the Show suggestions as you type option is enabled for Code Completion, Ctrl+Down and Ctrl+Up will close it and move the caret down or up in the editor.

15. Move method parameters in both declaration and invocation

You can move method parameters in both declaration and invocation with Ctrl+Alt+Shift+Left and Ctrl+Alt+Shift+Right. Moreover, you can propagate such move in a method declaration to the method invocation: press Alt+Enter after the move and choose Apply signature change.

Move method parameters in both declaration and invocation

16. Sort completion suggestions by relevance or alphabetically

You can sort completion suggestions by relevance or alphabetically.

  • To sort alphabetically, select the Sort by Name option.
  • To sort by relevance, clear the Sort by Name checkbox.
Sort completion suggestions by relevance or alphabetically

17. Regular expression

To verify that your regular expression is correct, place the caret within the expression you want to check, press Alt+Enter, and select Check RegExp.

In the popup frame type a sample string that should match your regular expression. If the background turns green, the match occurred. If it turns red, there is no match or your expression probably contains a mistake.

regular expression

18. Recent clipboard

Press Ctrl+Shift+V to choose from recent clipboard contents chunks and insert it.

19. To close all editor tabs

To close all editor tabs except the current one, keep pressed and click on the current editor tab.

close all editor tabs except the current one

20. Closing tabs

To close all editor tabs, right-click a tab and select Close All. To close all tabs except the active one, press and click on the active tab.

Exited to know more features from Android Studio? Visit the Android studio features page to know more.

Conclusion

In this post I showed you various android studio tips and tricks that you can apply in your day to day programming. If you have any questions or just want to chat with me, feel free to leave a comment below.

The post Android studio helpful tips and tricks appeared first on Learn Smart Coding.

]]>
https://blogs.learnsmartcoding.com/2020/08/12/android-studio-helpful-tips-and-tricks-to-speed-up-app-development/feed/ 1 665