Android App using Xamarin for Visual Studio Yoon Joong Kim Computer Engineering Department, Hanbat National University yjkim@hanbat.ac.kr 1
Xamarin for Visual Studio 설치 Deliver native Android, ios, and Windows apps, using existing skills,teams, and code Xamarin apps look and feel native because they are C# is the best language for mobile app development. Native user interfaces, built right before your eyes. Share code everywhere Download Xamarin for Visual Studio Download Visual Studio and Xamarin Android SDK Developer 최신구성요소로업데이트 2
Xamarin apps look and feel native because they are Native User Interfaces Xamarin apps are built with standard, native user interface controls. Apps not only look the way the end user expects, they behave that way too. Native API Access Xamarin apps have access to the full spectrum of functionality exposed by the underlying platform and device, including platform-specific capabilities like ibeacons and Android Fragments. Native Performance Xamarin apps leverage platform-specific hardware acceleration, and are compiled for native performance. This can t be achieved with solutions that interpret code at runtime. 3
C# is the best language for mobile app development. Anything you can do in Objective-C, Swift or Java, you can do in C#. More Types, Less Typing C# uses type inference to give developers more safety in fewer keystrokes, without boilerplate or verbose type annotations. Language-level Async Asynchronous programming (async) keeps apps responsive. In Objective-C, Swift and Java, async requires callbacks and manual bookkeeping. C# s language-level support makes async a breeze. Stronger Types, Smarter Tools Generics guarantee that collections and other compound types are used safely, without the need for casts or comments. Xamarin tools understand intent better thanks to richer types, with benefits like ubiquitous code completion. First-class Functions In Java for Android, lambdas are unavailable. In Objective-C, lambdas are extremely cumbersome. In C#, lambdas couldn t be simpler, making functional programmers feel right at home. 4
Native user interfaces, built right before your eyes. Xamarin apps use native UIs on every platform to enable the best possible experiences. Simplify mobile app design with our Android and ios designers, and build your own app today. 5
Share code everywhere Use the same language, APIs and data structures to share an average of 75% of app code across all mobile development platforms. Build user interfaces with Xamarin.Forms and share nearly 100%. 6
Share code everywhere Shared Projects Add any file to a Shared Project and it s automatically included on all platforms. Share code, images, and any other media across ios, Android, and Windows Phone. Portable Class Libraries Use popular Portable Class Libraries (PCLs) like SQLite, Json.NET, or ReactiveUI on every platform. Build your own app logic as a PCL and use it everywhere. Xamarin.Forms Xamarin.Forms allows you to build native user interfaces for ios, Android and Windows Phone using 100% shared C#. Xamarin.Forms includes more than 40 controls and layouts, which are mapped to native controls at runtime. 7
Download Xamarin for Visual Studio Visual Studiork 설치되어있는경우 실핼중인 Visual Studio 는중지시킨다. 아래링크를클릭하여 Xamrin 을다운로드하고설치한다. https://www.xamarin.com/vsdownload?utm_source=visualstudio&utm_medium=referral&utm_content= download&utm_campaign=installer 이름, 이메일, 회사명을입력하고 [Download Now] 클릭 다운로드및설치 모든선택은기봉으로 8
Download Visual Studio and Xamarin Visual Studio 가설치되있지않은경우 Download now for free Nice! You are about to download Visual Studio with Xamarin so you can write your apps entirely in C# and share the same code on ios, Android, Windows, Mac and more. Visual Studio 유무선택 기본으로모두선택하고다운로드설치실행 9
Android SDK Developer 최신구성요소설치 1. Android SDK Manager(in Visual Studio 2015) 실행 Visual Studio 에서 Tools > Android > Android SDK Manager 2. Android SDK Tools 설치 1. Install Android Tool 25.1.6 이상 Name > Tools > Android Tools 체크, install/ close & reopen Manager 2. Install the Android N (API 23, N preview): 3. Install the latest Android SDK tools these are listed under Tools (Preview Channel): https://developer.xamarin.com/guides/android/platform_features/introduction-to-android-n/ 10
Example Hello, Android 11
Hello, Android Xamarin.Android application(using Xamarin Studio or Visual Studio) 개발 an understanding of the fundamentals of Android application development with Xamarin 목적 : App 의개발환경및절차를이해한다. Alphanumeric 전화번호를입력받아수치전화번호로번역하고전화걸기 https://developer.xamarin.com/guides/android/getting_started/hello,android/hello,android_quickstart/ 12
Target The final application looks like this: 13
Requiremetns Visual Studio 2015 Xamarin for visual studio latest version of Xamarin.Android is installed Android ADK Developer 최신구성요소설치 14
1. 파일 > 새로만들기 > 프로젝트 템플릿.. > 템플릿 >Blank App(Android) 이름 PhoneWord 15
Open Main.axml in the Android Designer Solution Explorer > Resources >layout > main.axml 16
Hello World, Click Me! 버튼을클릭하고삭제, 도구상자 Form Wigets 그룹의 Text(Large) 콘트롤을드래그하여디자인면에위치시킨다. 17
Text(Large) 콘트롤을선택한상태에서속성창에서 Text 속성의값을 Enter a PhoneWord: 로입력한다. 18
도구상자 Text Fields 그룹의 Plain Text 위젯을드래그하여디자인면에위치시킨다. 19
@+id/phonenumbertext Plain Text 콘트롤을선택하고 Plain Text 콘트롤의속성값을수정한다. Id : @+id/phonenumbertext Text : 1-855-XMARIN 20
@+id/phonenumbertext 도구상자 Form Widgets 그룹의 Button 을드래그하여디자인면 Plain Text 위벳아래에배치한다. 21
@+id/phonenumbertext Button 콘트롤을선택하고 Button 콘트롤의속성값을수정한다. Id : @+id/translatebutton Text : Translate : 22
@+id/phonenumbertext 도구상자에서 Button 콘트롤을디자인면의 Translate 버튼아래로드래그한다. 추가된 Button 콘트롤의속성값을수정한다. Id : @+id/callbutton Text : Call 수행한작업을저장한다. Ctrl + S 23