Home » Android » Is there a keyboard shortcut to findviewbyId in Android?

Is there a keyboard shortcut to findviewbyId in Android?

Posted by: admin May 14, 2020 Leave a comment

Questions:

I don’t like to write findViewById everytime is there a keyboard shortcut for it please I am a newbie to coding help me ?

How to&Answers:

As a Matter of fact there is a keyboard shortcut to write findViewById

  • if you want to write findViewById you could write fb+enter in valid context
  • if you want to write findViewById(R.id.) you could write fbc+enter

Answer:

I don’t know for shortcuts, but there is a library called ButterKnife which really simplifies some process like findViewById() or getRescources() and many others 😉

http://jakewharton.github.io/butterknife/

Answer:

When you type fbc you will get live template

Answer:

You can use:

Ctrl + Shift + Space

For other useful shortcuts visit here

Answer:

You may use this function as follows:

private <T> T $(@IdRes int id) {
    return (T) findViewById(id);
}