Android Coder: Pinpoint Search Results in Android Studio

I started out in IntelliJ IDEA when I moved from .NET to Java a couple of years ago, but I locked-in on Eclipse. I’m a huge Eclipse fan as you know, but the more time I spend in Android Studio the more I think IntelliJ IDEA will be my IDE going forward. I’m investing in getting the most out of the IntelliJ Android Studio platform and one of the ways to do so is create custom search scopes for pinpoint search results.

Let’s say we want to go to where we’re loading our activity_pager layout in our Activity Class. If we do a standard search we’ll see something like the following, when all we want is the setContentView(R.layout.activity_pager); statement in That’s the line highlighted in blue.

What we’re going to do is create a custom search scope that searches only our app/*.java files. The IntelliJ Scopes Dialog makes it super easy to create custom scopes by selecting folders and files to include or exclude. I initially created the scope so I could avoid seeing resource listings in the file, so I called the scope “No” You can see that our final pattern is *.java||file:src//*.

Now we’ll use the new “No” custom scope.

Yes, much better!