[Android] MOTODEV Studio for Android のコードスニペットが便利すぎる件

| トラックバック(0) |

studio_android_banner.png

MOTODEV Studio for Android には、いくつかの便利な機能が搭載されているのですが、

中でも、コードスニペットが恐ろしく便利でした!

生産性向上に役立つだけでなく、逆引き形式での勉強にも最適です。

 

コードスニペットとは

code_snippets.png

「よく使われる典型的なコードのテンプレート」であり、

MOTODEV Studio for Android には、選択してワンクリックで追加できる様々なコードスニペットが用意されています。

 

例えば、トーストを表示するコードを書きたい場合、

以下のように [Snippets] - [General] > [Toast Pop-up Notofication]をクリックします。

code_snippets_select.png

 

すると、以下のようなコードが挿入されます。

Toast.makeText(this, "Put your message here", Toast.LENGTH_SHORT).show();

 

挿入直後には、import すべきパッケージが挿入されないので、

エラー箇所(赤い波線)を右クリックして、「Quick Fix」>「Import XXX」を選択し、必要なパッケージをimport させてください。

code_snippets_quick_fix.png

 

以下に、サポートしているコードスニペットの名前を列挙しておきます。

ほとんどのものは、名前だけで想像できると思います。

 

System Services

  • Activity Manager
  • Alarm Manager
  • Audio Manager
  • Clipboad Manager
  • Connectivity Manager
  • Input Method Manager
  • Keyguard Manager
  • Layout Inflater Manager
  • Location Manager
  • Notification Manager
  • Power Manager
  • Search Manager
  • Telephony Manager
  • Vibrator
  • Wallpaper
  • Wi-Fi Manager
  • Windows Manager

 

General

  • Sending an SMS
  • Toast Pop-up Notification
  • Status Bar Notification
  • Vibrate the phone for a given time
  • Vibrate the phone following a given pattern
  • Assign an action to a button

 

Database

  • Database - Create/Open
  • Database - Delete
  • Table - Create
  • Table - Delete
  • Entry - Insert
  • Entry - Update
  • Entry - Delete
  • Run Query

 

Menu

  • Add and Handle Menu Items
  • Enable/disable Menu Items
  • Add a Submenu
  • Define Menu in XML
  • Inflate Menu from XML

 

Dialogs

  • Alert Dialog
  • Progress Dialog
  • Progress Bar Dialog
  • Date Picker Dialog
  • TIme Picker Dialog
  • Custom DIalog
  • Custom Alert Dialog

 

Screen

  • Make an Activity Fullscreen
  • Get the screen size
  • Get the screen orientation

 

GPS

  • Get GPS coordinates
  • Distance between two GPS coordinates
  • Register a listener to monitor changes in location
  • Register a listener to be called when a location is near

 

Network

  • Making a HTTP POST Request
  • Sending an E-mail

 

Media

  • Play Audio/Video from a file in your application
  • Play Audio/Video from a file in local filesystem or URL
  • Start recording Audio
  • Start recording Video
  • Stop recording Audio/Video

 

Preferences

  • Retrieve shared preferences
  • Retrieve non-shared preferences
  • Edit shared preferences
  • Edit non-shared preferences

 

Resources and Assets

  • List the assers in a folder
  • Read an asset as a stream of bytes
  • Read a XML file

 

Log

  • Add ERROR message
  • Add WARNING message
  • Add INFO message
  • Add DEBUG message

トラックバック(0)

トラックバックURL: http://mt.adakoda.com/mt-tb.cgi/307

Android Advent Calendar 2011

2012年2月

      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29