Android Studio: Sample

From OnnoWiki
Revision as of 09:17, 24 February 2015 by Onnowpurbo (talk | contribs)
Jump to navigation Jump to search

Welcome to code samples for Android developers. Here you can browse sample code and learn how to build different components for your applications. Use the categories on the left to browse the available samples.

Setiap sampel adalah aplikasi Android yang berfungsi penuh. Anda dapat menelusuri sumber daya, source file dan melihat struktur proyek secara keseluruhan. Anda dapat copy dan paste kode yang Anda butuhkan, dan jika Anda ingin berbagi link ke baris tertentu Anda dapat mengklik dua kali untuk mendapatkan URL.


Import Sampel dari GitHub

Android Studio menyediakan akses mudah untuk mengimpor contoh source code Android dari GitHub dan merupakan metode yang direkomendasikan untuk mengambil contoh source code Android.

Untuk meng-import source code contoh ke Android Studio:

  • Di menu Android Studio, pilih File > Import Sample untuk membuka Import Sample wizard.
  • Pilih sampel yang akan di import dan click Next.
  • Tentukan nama aplikasi dan lokasi project jika berbeda dari setting yang ada.
  • klik Finish.

Contoh project akan dibuka di new Android Studio project.

Note: When starting Android Studio, you can also select Import an Android code sample in the Welcome to Android Studio wizard to import a sample project from GitHub as a new project.

For more information about importing samples, see Easy access to Android code samples on GitHub.

Download Samples

Although importing samples from Android Studio is the recommended method, you can also use the categories on the left to browse the available samples and learn how to build different components for your applications.

If you want to download a complete project, just click on any source file in the project and click the Download link in the upper right of the source page.

To import a downloaded project:

  • Unpack the downloaded project package.
  • In Android Studio, chose File > Import Project and select the root folder of the unpacked project.

Android Studio may ask you to choose the type of project you are importing. If this is the case, make sure to choose Import project from external model and select the Gradle option.

Note: When starting Android Studio, you can also select Import Non-Android Studio project in the Welcome to Android Studio wizard to import a downloaded sample project.

Note: At this time, the downloadable projects are designed for use with Gradle and Android Studio.



Referensi