Android studio cheat sheet

This is a simple set of tips and tricks regarding Android Development which I have gathered from various sources. Its also there for me to keep track of anything I either learn on my own or from other sources now and then when browsing the internet.

Use Live Templates in Android Studio

  • newInstance – Generates the static newInstance function inside a Fragment
  • Toast – Generates Toast.makeText(context, "", Toast.LENGTH_SHORT).show();
  • fbc – findViewById with cast
  • const – Define a android style int constant
  • logd – Generates Log.d(TAG, "");
  • logm – Log current method name and its arguments.
  • logr – Log result of the current method
  • logt – static logtaf with current classname
  • psf – public static final
  • sout – Prints a string to System.out
  • soutm – Prints current class and method names to System.out
  • soutp – Prints method parameter names and values to System.out
  • visible – Set view visibility to VISIBLE
  • gone – Set view visibility to GONE
  • noInstance – private empty constructor to prohibit instance creation

Happy coding!😀

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s