Enviar pesquisa
Carregar
Code to go Android
•
1 gostou
•
1,076 visualizações
Peter van der Linden
Seguir
A basic intro to Android development
Leia menos
Leia mais
Tecnologia
Denunciar
Compartilhar
Denunciar
Compartilhar
1 de 52
Baixar agora
Baixar para ler offline
Recomendados
Gl android platform
Gl android platform
Pragya Rastogi
Ios - Introduction to platform & SDK
Ios - Introduction to platform & SDK
Vibrant Technologies & Computers
Android studio
Android studio
Andri Yabu
What’s new in aNdroid [Google I/O Extended Bangkok 2016]
What’s new in aNdroid [Google I/O Extended Bangkok 2016]
Sittiphol Phanvilai
Android dev o_auth
Android dev o_auth
lzongren
Demystifying Docker
Demystifying Docker
Cloud Native Bangalore
Appcelerator Titanium - An Introduction to the Titanium Ecosystem
Appcelerator Titanium - An Introduction to the Titanium Ecosystem
Boydlee Pollentine
iSalesDoc - Make your own sales Apps
iSalesDoc - Make your own sales Apps
i2dnetwork
Recomendados
Gl android platform
Gl android platform
Pragya Rastogi
Ios - Introduction to platform & SDK
Ios - Introduction to platform & SDK
Vibrant Technologies & Computers
Android studio
Android studio
Andri Yabu
What’s new in aNdroid [Google I/O Extended Bangkok 2016]
What’s new in aNdroid [Google I/O Extended Bangkok 2016]
Sittiphol Phanvilai
Android dev o_auth
Android dev o_auth
lzongren
Demystifying Docker
Demystifying Docker
Cloud Native Bangalore
Appcelerator Titanium - An Introduction to the Titanium Ecosystem
Appcelerator Titanium - An Introduction to the Titanium Ecosystem
Boydlee Pollentine
iSalesDoc - Make your own sales Apps
iSalesDoc - Make your own sales Apps
i2dnetwork
Grand finale
Grand finale
Peter van der Linden
Droidcon berlin Apr2013
Droidcon berlin Apr2013
Peter van der Linden
Master pass api
Master pass api
Peter van der Linden
Intro to Android Programming
Intro to Android Programming
Peter van der Linden
GDC 2014 talk Haptics Android
GDC 2014 talk Haptics Android
Peter van der Linden
Putting real feeling into Android Apps
Putting real feeling into Android Apps
Peter van der Linden
Master cardapis v7.2020
Master cardapis v7.2020
Peter van der Linden
Android Programming made easy
Android Programming made easy
Lars Vogel
Coding to the MasterCard OpenAPIs
Coding to the MasterCard OpenAPIs
Peter van der Linden
Android - Sensor Manager
Android - Sensor Manager
Yong Heui Cho
Lec005 android start_program
Lec005 android start_program
Eyad Almasri
PhoneGap Application Development - Santhi J Krishnan
PhoneGap Application Development - Santhi J Krishnan
OrisysIndia
Android momobxl
Android momobxl
Steven Palmaers
Ayw android env_setup
Ayw android env_setup
pbeerak
Android
Android
BVP GTUG
ANDROID PPT 1.pdf
ANDROID PPT 1.pdf
Siva Krishna Prasad
Android application development
Android application development
slidesuren
Seminar on android app development
Seminar on android app development
AbhishekKumar4779
Android Intro
Android Intro
Justin Grammens
01 04 - android set up and creating an android project
01 04 - android set up and creating an android project
Siva Kumar reddy Vasipally
Android Application Development Using Java
Android Application Development Using Java
amaankhan
Java Meetup - 12-03-15 - Android Development Workshop
Java Meetup - 12-03-15 - Android Development Workshop
Kasun Dananjaya Delgolla
Mais conteúdo relacionado
Destaque
Grand finale
Grand finale
Peter van der Linden
Droidcon berlin Apr2013
Droidcon berlin Apr2013
Peter van der Linden
Master pass api
Master pass api
Peter van der Linden
Intro to Android Programming
Intro to Android Programming
Peter van der Linden
GDC 2014 talk Haptics Android
GDC 2014 talk Haptics Android
Peter van der Linden
Putting real feeling into Android Apps
Putting real feeling into Android Apps
Peter van der Linden
Master cardapis v7.2020
Master cardapis v7.2020
Peter van der Linden
Android Programming made easy
Android Programming made easy
Lars Vogel
Coding to the MasterCard OpenAPIs
Coding to the MasterCard OpenAPIs
Peter van der Linden
Android - Sensor Manager
Android - Sensor Manager
Yong Heui Cho
Destaque
(10)
Grand finale
Grand finale
Droidcon berlin Apr2013
Droidcon berlin Apr2013
Master pass api
Master pass api
Intro to Android Programming
Intro to Android Programming
GDC 2014 talk Haptics Android
GDC 2014 talk Haptics Android
Putting real feeling into Android Apps
Putting real feeling into Android Apps
Master cardapis v7.2020
Master cardapis v7.2020
Android Programming made easy
Android Programming made easy
Coding to the MasterCard OpenAPIs
Coding to the MasterCard OpenAPIs
Android - Sensor Manager
Android - Sensor Manager
Semelhante a Code to go Android
Lec005 android start_program
Lec005 android start_program
Eyad Almasri
PhoneGap Application Development - Santhi J Krishnan
PhoneGap Application Development - Santhi J Krishnan
OrisysIndia
Android momobxl
Android momobxl
Steven Palmaers
Ayw android env_setup
Ayw android env_setup
pbeerak
Android
Android
BVP GTUG
ANDROID PPT 1.pdf
ANDROID PPT 1.pdf
Siva Krishna Prasad
Android application development
Android application development
slidesuren
Seminar on android app development
Seminar on android app development
AbhishekKumar4779
Android Intro
Android Intro
Justin Grammens
01 04 - android set up and creating an android project
01 04 - android set up and creating an android project
Siva Kumar reddy Vasipally
Android Application Development Using Java
Android Application Development Using Java
amaankhan
Java Meetup - 12-03-15 - Android Development Workshop
Java Meetup - 12-03-15 - Android Development Workshop
Kasun Dananjaya Delgolla
AndEngine
AndEngine
TheBeege
Anatomy of a Codename One Application
Anatomy of a Codename One Application
ShaiAlmog1
Installing eclipse & sdk
Installing eclipse & sdk
Arun Kumar
Android - Anroid Pproject
Android - Anroid Pproject
Vibrant Technologies & Computers
Developing for Android-Types of Android Application
Developing for Android-Types of Android Application
Nandini Prabhu
Native apps in html5 with chrome packaged apps
Native apps in html5 with chrome packaged apps
Tom Wilson
Android development session
Android development session
Esraa Ibrahim
Day: 2 Environment Setup for Android Application Development
Day: 2 Environment Setup for Android Application Development
Ahsanul Karim
Semelhante a Code to go Android
(20)
Lec005 android start_program
Lec005 android start_program
PhoneGap Application Development - Santhi J Krishnan
PhoneGap Application Development - Santhi J Krishnan
Android momobxl
Android momobxl
Ayw android env_setup
Ayw android env_setup
Android
Android
ANDROID PPT 1.pdf
ANDROID PPT 1.pdf
Android application development
Android application development
Seminar on android app development
Seminar on android app development
Android Intro
Android Intro
01 04 - android set up and creating an android project
01 04 - android set up and creating an android project
Android Application Development Using Java
Android Application Development Using Java
Java Meetup - 12-03-15 - Android Development Workshop
Java Meetup - 12-03-15 - Android Development Workshop
AndEngine
AndEngine
Anatomy of a Codename One Application
Anatomy of a Codename One Application
Installing eclipse & sdk
Installing eclipse & sdk
Android - Anroid Pproject
Android - Anroid Pproject
Developing for Android-Types of Android Application
Developing for Android-Types of Android Application
Native apps in html5 with chrome packaged apps
Native apps in html5 with chrome packaged apps
Android development session
Android development session
Day: 2 Environment Setup for Android Application Development
Day: 2 Environment Setup for Android Application Development
Último
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
UK Journal
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
Principled Technologies
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
Delhi Call girls
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
debabhi2
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
sammart93
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
wesley chun
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
Product Anonymous
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
hans926745
presentation ICT roal in 21st century education
presentation ICT roal in 21st century education
jfdjdjcjdnsjd
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
ThousandEyes
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
Antenna Manufacturer Coco
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
Rafal Los
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
lior mazor
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Drew Madelung
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
sudhanshuwaghmare1
Último
(20)
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
presentation ICT roal in 21st century education
presentation ICT roal in 21st century education
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
Code to go Android
1.
Peter van der
Linden Android Technology Evangelist Jan 2014 NASDAQ: IMMR Code to go! Writing your first Android app ©2012 Immersion Corporation–Confidential
2.
■ Agenda 1 Compilation tools 2 Importing an
existing project 3 The folders that make up an app 4 GUI Basics 5 Run it! Slides online at: ©2012 Immersion Corporation–Confidential
3.
1 Compilation tools 2 Importing
an existing project 3 The folders that make up an app 4 GUI Basics 5 Adding some Views ©2012 Immersion Corporation–Confidential
4.
Compilation tools ■ Technologies: ■
Java, XML, SQLite, OpenGL, embedded development ■ Tools ■ Eclipse (and Android Studio, based on IntelliJ IDE) ■ Android SDK ■ Platform libraries ©2012 Immersion Corporation–Confidential
5.
Compilation tools Eclipse ADT Eclipse plugin workspace project your app code platform library ©2012
Immersion Corporation–Confidential SDK build
6.
Eclipse main screen ©2012
Immersion Corporation–Confidential
7.
Eclipse main screen Your source
code file Your projects ©2012 Immersion Corporation–Confidential
8.
Using Eclipse ■ Eclipse
video tutorials http://eclipsetutorial.sourceforge.net/totalbeginner.html http://www.vogella.de/articles/Eclipse/article.html ■ Eclipse “Perspective” reset Window > Reset Perspective > Yes ©2012 Immersion Corporation–Confidential
9.
1 Compilation tools 2 Importing
an existing project 3 The folders that make up an app 4 GUI Basics 5 Run it! ©2012 Immersion Corporation–Confidential
10.
What if I
did not download any platforms? Then do it now. Download Platform 14, and use that throughout. In Eclipse, click on Window > Android SDK Manager Running your Studio Project Under “Android 4.0 (API 14) Click on “SDK Platform” Then click “Install” These are large 100MB downloads – don’t download more than you need till you are back on your home network ©2012 Immersion Corporation–Confidential
11.
What if I
did not put the SDK tools in my path? Take a demerit for Gryffindor, and add the folders now. MacOS – edit file ~/.bash_profile to add these 2 directories to PATH by adding this at the end of the file (use names for your PC!) Running your Studio Project export PATH=$PATH:/Users/plinden/android-sdk-macosx/ tools:/Users/plinden/android-sdk-macosx/platform-tools! Linux – add the SDK two folders, tools and platform-tools, to your PATH in your shell initialization file (file varies with the shell you use). Windows – path environment variable is set somewhere under control panel. Google “Windows 7 set env variable” (windows 8 etc) ©2012 Immersion Corporation–Confidential
12.
Get my existing
project “feels” into Eclipse Download the zip file from http://goo.gl/TN2Hpq On that page, hit File > Download ©2012 Immersion Corporation–Confidential
13.
Importing existing project
into Eclipse Unzip the downloaded feels.zip file somewhere handy File > Import … > Existing files into workspace ©2012 Immersion Corporation–Confidential
14.
Imported project appears
in Eclipse You can expand folders by clicking right pointing triangle If project has errors, click Project > Clean > OK ©2012 Immersion Corporation–Confidential
15.
■ Agenda 1 Compilation tools 2 Creating a
new project 3 The folders that make up an app 4 GUI Basics 5 Adding some Views 6 Execution tools ©2012 Immersion Corporation–Confidential
16.
Files that make
up a Mobile App ■ Java files ■ Resource files ■ Png files for icons (up to 5 different screen resolutions) ■ XML files to specify the GUI layout and controls ■ XML files to hold literal strings ■ A project manifest file in XML ■ Asset files (photos, music, video…, other files not compiled or localized) ©2012 Immersion Corporation–Confidential
17.
Ingredients of an
App • Source code for every Android app has: AndroidManifest.xml describes the app overall, features used, version, etc Java “glue” XML, icons Media, data files, etc • App binary is an .apk file (zip format) • contains the compiled version of these files ©2012 Immersion Corporation–Confidential
18.
The “Top 2
folders” – src, res ■ Java files ■ Resource files ■ Png files for icons (1-5 dpi’s) { ■ XML files for GUI layout ■ XML files to hold literal strings ■ A project manifest file in XML ■ Restriction: filenames under res folder must contain only lowercase a-z, 0-9, or _. ©2012 Immersion Corporation–Confidential
19.
1 Compilation tools 2 Importing an
existing project 3 The folders that make up an app 4 GUI Basics 5 Run it! ©2012 Immersion Corporation–Confidential
20.
GUIs in Android Views
(Widgets, Controls) ■ E.g. Button, CheckBox, TextView, ProgressBar, ■ About 70 basic controls Layouts ■ Defines where each View is on a screen ■ One XML file per screen ■ “alternative resources” – diff layout for portrait vs land Event handlers ■ When a user “operates” a View, it fires an event ■ Developer writes event handler code to process it ©2012 Immersion Corporation–Confidential
21.
GUIs in Android
- diagram Layout Views Event Handlers open_db(); take_pic(); § how it looks § what events it fires § specified in XML in a layout file § position on screen § specified in XML file § the Activity sets this file as its “content view” (how it looks) ©2012 Immersion Corporation–Confidential § what happens when view is clicked § written in Java
22.
Some Views in
more detail ©2012 Immersion Corporation–Confidential
23.
Peter’s handy-dandy XML
cheat-sheet What it’s called What it looks like Declaration <?xml version="1.0" encoding="utf-8"?> Element <someTagName attributes> nested_elements </someTagName> Element <someTagName attributes /> Attribute someName=“someValue” Comment <!-- Namespace Declaration Xmlns:someNamespaceName="someURI" some commentary here --> Android namespace declaration xmlns:android= "http://schemas.android.com/apk/res/android" Attribute name from android namespace android:layout_width="fill_parent" ©2012 Immersion Corporation–Confidential
24.
Getting into XML §
There is an XML file defining the GUI objects on its screen/ Activity <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent” > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello” /> </LinearLayout> ©2012 Immersion Corporation–Confidential
25.
XML for a
View § Every View must have a value for android:layout_width and _height Tells layout manager how much room you want for the WIDTH and the HEIGHT of the component § "fill_parent” magic word that says “greedy – as much as possible” “match_parent” is also used. § "wrap_content” magic word that says “frugal – as little as possible” <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello” /> ©2012 Immersion Corporation–Confidential
26.
Gluing XML names
to Java code The XML names in res folder are visible in Java namespace! The glue code is generated for you. Create an ID name for an XML element with this attribute <TextView android:id="@+id/myTV" In Java, get hold of that XML-declared TextView by: TextView tv = (TextView) findViewById( R.id.myTV ); In XML, get hold of that XML-declared TextView by: <Button android:layout_below=”@id/myTV" ©2012 Immersion Corporation–Confidential
27.
android.widget.TextView ■ Appearance: <TextView android:layout_width=“fill_parent” ©2012 Immersion
Corporation–Confidential />
28.
android.widget.TextView ■ Appearance: <TextView android:layout_width=“wrap_content” ©2012 Immersion
Corporation–Confidential />
29.
android.widget.TextView ■ Appearance: ■ XML
in res/layout/myname.xml <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#0FF" android:text="width is wrap_content" /> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#FF0000" android:text="width is fill_parent" /> ©2012 Immersion Corporation–Confidential
30.
Easy to make
mistakes! ■ Appearance: XML in res/layout/myname.xml <TextView android:layout_width="wrap_content" android:layout_height=”fill_parent" android:background="#0FF" android:text="width is wrap_content" /> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#FF0000" android:text="width is fill_parent" /> ©2012 Immersion Corporation–Confidential
31.
Attributes for android.widget.TextView ■
Use the Android Developer Docs ■ http://developer.android.com/reference/android/R.styleable.html#TextView ■ There are about 75 attributes for TextView ©2012 Immersion Corporation–Confidential
32.
android.widget.Button ■ Appearance: disabled enabled ■ XML <Button
android:layout_width="fill_parent" android:layout_height="wrap_content” android:text="@string/brew" android:id="@+id/bt" /> ©2012 Immersion Corporation–Confidential pressed
33.
android.widget.EditText ■ Appearance: <EditText a someAttributes /> ■ Subclass
of TextView ■ No new attributes of its own ■ Requires the usual layout attribs ■ Click in the field to get keyboard ■ And type away… ©2012 Immersion Corporation–Confidential
34.
Event Handlers in
more detail ©2012 Immersion Corporation–Confidential
35.
android.widget.EditText Event Handler ■
Gives you the contents of entire field for each keypress ■ Implement android.view.View.OnKeyListener ■ Only has 1 method: onKey(View v, int keyCode, KeyEvent event) ■ Register your listener with: myedittext.setOnKeyListener( objOnKeyListener ); ©2012 Immersion Corporation–Confidential
36.
android.widget.EditText key listener public void
onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final EditText et = (EditText) findViewById(R.id.et); OKL my_okl = new OKL(); et.setOnKeyListener(my_okl); } } class OKL implements OnKeyListener { public boolean onKey(View v, int keyCode, KeyEvent event) { if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // Perform action only for "return" key press EditText et = (EditText) v; Log.i("Hi app", et.getText().toString()); return true; // have "consumed event" } return false; // have not consumed event } } ©2012 Immersion Corporation–Confidential
37.
android.widget.Button ■ Gives you
an event when clicked ■ Implement android.view.View.OnClickListener ■ Only has 1 method: onClick(View v) ■ Register your listener with code: mybutton.setOnClickListener( objOnClickListener); ■ Or register your listener with XML attribute: <Button … android.onClick=“doAction” /> public void doAction(View v) { … } ©2012 Immersion Corporation–Confidential
38.
android.widget.Button event handler public
void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final Button bt = (Button)findViewById(R.id.bt); CL my_cl = new CL(); bt.setOnClickListener(my_cl); } public void doAction(View v) { // button has been pressed Log.i("Hi app", v.toString() + " pressed,doAction called"); } class CL implements OnClickListener { public void onClick(View v) { Log.i("Hi app", v.toString() + " pressed"); } } ©2012 Immersion Corporation–Confidential
39.
Debugging First choice –
the debugger Here are some quick ‘n dirty alternatives to see what is going on in your code ©2012 Immersion Corporation–Confidential
40.
Always have “adb
logcat” running in a terminal! 01-22 18:31:30.520 11946 11946 W dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x40018560) 01-22 18:31:30.559 11946 11946 E AndroidRuntime: FATAL EXCEPTION: main 01-22 18:31:30.559 11946 11946 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.hi/ com.example.hi.HiActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class Checkbox 01-22 18:31:30.559 11946 11946 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1696) 01-22 18:31:30.559 11946 11946 E AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1716) 01-22 18:31:30.559 11946 11946 E AndroidRuntime: at android.app.ActivityThread.access$1500(ActivityThread.java:124) 01-22 18:31:30.559 11946 11946 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:968) 01-22 18:31:30.559 11946 11946 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99) 01-22 18:31:30.559 11946 11946 E AndroidRuntime: at android.os.Looper.loop(Looper.java:130) 01-22 18:31:30.559 11946 11946 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:3806) 01-22 18:31:30.559 11946 11946 E AndroidRuntime: at java.lang.reflect.Method.invokeNative(Native Method) 01-22 18:31:30.559 11946 11946 E AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:507) 01-22 18:31:30.559 11946 11946 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 01-22 18:31:30.559 11946 11946 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 01-22 18:31:30.559 11946 11946 E AndroidRuntime: at dalvik.system.NativeStart.main(Native Method) 01-22 18:31:30.559 11946 11946 E AndroidRuntime: Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class Checkbox 01-22 18:31:30.559 11946 11946 E AndroidRuntime: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:581) 01-22 18:31:30.559 11946 11946 E AndroidRuntime: at android.view.LayoutInflater.rInflate(LayoutInflater.java:623) 01-22 18:31:30.559 11946 11946 E AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:408) 01-22 18:31:30.559 11946 11946 E AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:320) 01-22 18:31:30.559 11946 11946 E AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:276) 01-22 18:31:30.559 11946 11946 E AndroidRuntime: at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256) 01-22 18:31:30.559 11946 11946 E AndroidRuntime: at android.app.Activity.setContentView(Activity.java:1703) 01-22 18:31:30.559 11946 11946 E AndroidRuntime: at com.example.hi.HiActivity.onCreate(HiActivity.java:19) 01-22 18:31:30.559 11946 11946 E AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 01-22 18:31:30.559 11946 11946 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1660) 01-22 18:31:30.559 11946 11946 E AndroidRuntime: ... 11 more 01-22 18:31:30.559 11946 11946 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: android.view.Checkbox in loader dalvik.system.PathClassLoader[/data/app/com.example.hi-1.apk] ©2012 Immersion Corporation–Confidential
41.
Logging import android.util.Log; Log.i(”Activity ID",
“message to log, i=” + i); In a shell, run $ adb logcat ©2012 Immersion Corporation–Confidential
42.
Toast Toast – an
easy way to make text “pop up” on screen. Do it when in UI thread in Activity. ! import android.widget.toast;! …! Toast.makeText( this, ! ! ! !“my string”,! ! ! !Toast.LENGTH_LONG ).show();! ! ! this is the toast pop-up ©2012 Immersion Corporation–Confidential
43.
1 Compilation tools 2 Creating a
new project 3 The folders that make up an app 4 GUI Basics 5 Run it! ©2012 Immersion Corporation–Confidential
44.
Create a virtual
device Window > Android Virtual Device Manager ©2012 Immersion Corporation–Confidential
45.
Create a virtual
device The only config that really matters is the platform API level. Here API 14. ©2012 Immersion Corporation–Confidential
46.
Create a virtual
device Window > Android Virtual Device Manager ©2012 Immersion Corporation–Confidential
47.
©2012 Immersion Corporation–Confidential
48.
Run app on
phone / tablet ©2012 Immersion Corporation–Confidential
49.
©2012 Immersion Corporation–Confidential
50.
Well Done! § Well
done! § We’re done! § Q & A welcome ©2012 Immersion Corporation–Confidential
51.
Connect with Immersion #HapticsDev like
“ImmersionDeveloper” search “Immersion Corporation” ©2012 Immersion Corporation–Confidential
52.
Some great Android
resources § http://developer.android.com § http://developer.immersion.com § http://stackoverflow.com § Web search for keywords “Android notification tutorial” § Have a great time with this! ©2012 Immersion Corporation–Confidential
Baixar agora