第一个android程序:helloworld
2011-07-24 11:54
387 查看
平台前向兼容软件: 指老平台下生成的程序在新平台上也能运行。等价于软件后向兼容平台。
根据coolszy的操作过程可以正确完成helloworld程序,感谢coolszy的视频。
android模拟器每次运行都会临时生成几个tmp临时文件,时间长了,可能占用几G的空间,目录为
【win7用户】C:\Users\Administrator\AppData\Local\Temp\AndroidEmulator文件夹下
或者【xp用户】C:\Documents and settings\"用户名"\Local settings\Temp\AndroidEmulator文件夹下。
android核心开发包
android.util Provides common utility methods such as date/time manipulation, base64 encoders and decoders, string and number conversion methods, and XML utilities.
android.os Provides basic operating system services, message passing, and inter-process communication on the device.
android.graphics Provides low level graphics tools such as canvases, color filters, points, and rectangles that let you handle drawing to the screen directly.
android.text Provides classes used to render or track text and text spans on the screen.
android.database Contains classes to explore data returned through a content provider.
android.content Contains classes for accessing and publishing data on a device.
android.view Provides classes that expose basic user interface classes that handle screen layout and interaction with the user.
android.widget The widget package contains (mostly visual) UI elements to use on your Application screen.
android.app Contains high-level classes encapsulating the overall Android application model.
android.provider Provides convenience classes to access the content providers supplied by Android.
android.telephony Provides APIs for monitoring the basic phone information, such as the network type and connection state, plus utilities for manipulating phone number strings.
android.webkit Provides tools for browsing the web.
HelloActivity派生自android.app.Activity,这个类的派生关系如下
它有两个重要的成员函数。
Bundle类用于A mapping from String values to various Parcelable types. 具体作用目前还不明确。
setContentView(R.layout.main);这句话输入的是预置的一个view。也就是说每个android应用会有一个默认的view。具体见main.xml
<?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>
这个view的文本就是输出结果,见string.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello World, HelloActivity!</string>
<string name="app_name">Hello</string>
</resources>
根据coolszy的操作过程可以正确完成helloworld程序,感谢coolszy的视频。
android模拟器每次运行都会临时生成几个tmp临时文件,时间长了,可能占用几G的空间,目录为
【win7用户】C:\Users\Administrator\AppData\Local\Temp\AndroidEmulator文件夹下
或者【xp用户】C:\Documents and settings\"用户名"\Local settings\Temp\AndroidEmulator文件夹下。
android核心开发包
android.util Provides common utility methods such as date/time manipulation, base64 encoders and decoders, string and number conversion methods, and XML utilities.
android.os Provides basic operating system services, message passing, and inter-process communication on the device.
android.graphics Provides low level graphics tools such as canvases, color filters, points, and rectangles that let you handle drawing to the screen directly.
android.text Provides classes used to render or track text and text spans on the screen.
android.database Contains classes to explore data returned through a content provider.
android.content Contains classes for accessing and publishing data on a device.
android.view Provides classes that expose basic user interface classes that handle screen layout and interaction with the user.
android.widget The widget package contains (mostly visual) UI elements to use on your Application screen.
android.app Contains high-level classes encapsulating the overall Android application model.
android.provider Provides convenience classes to access the content providers supplied by Android.
android.telephony Provides APIs for monitoring the basic phone information, such as the network type and connection state, plus utilities for manipulating phone number strings.
android.webkit Provides tools for browsing the web.
HelloActivity派生自android.app.Activity,这个类的派生关系如下
java.lang.Object | ||||
↳ | android.content.Context | |||
↳ | android.content.ContextWrapper | |||
↳ | android.view.ContextThemeWrapper | |||
↳ | android.app.Activity |
onCreate(Bundle)是用来初始化activity的地方。
setContentView(int)把UI在activity上显示。view是可以在Activity上显示的,而view都已经资源化,所以只需要输入view的ID即可,这个ID在xml文件中维护。
Bundle类用于A mapping from String values to various Parcelable types. 具体作用目前还不明确。
setContentView(R.layout.main);这句话输入的是预置的一个view。也就是说每个android应用会有一个默认的view。具体见main.xml
<?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>
这个view的文本就是输出结果,见string.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello World, HelloActivity!</string>
<string name="app_name">Hello</string>
</resources>
相关文章推荐
- Intellij Idea12第一个安卓程序开发(HelloWorld)及简单讲解Android
- 【Android Developer】2.Android的第一个Helloworld程序
- 第一个Android程序HelloWorld
- 尴尬的第一个Android程序——HelloWorld
- Intellij Idea12第一个安卓程序开发(HelloWorld)及简单讲解Android
- 我的第一个android程序 HelloWorld
- Android开发-第一个程序Helloworld
- 我的第一个android程序 HelloWorld
- android的第一个程序helloworld (有图有真相)
- 开启Android开发之旅:环境搭建及第一个Android程序:HelloWorld
- 【Android】简单详细的安卓开发环境配置及运行第一个程序Helloworld
- 〖用cocos2d-android引擎写游戏〗(一)第一个程序HelloWorld
- 编写第一个Android程序------HelloWorld
- Android开发学习笔记:我的第一个Android程序--HelloWorld
- 【编程】我的第一个android程序HelloWorld
- 〖用cocos2d-android引擎写游戏〗(一)第一个程序HelloWorld
- 3. 编写的第一个android HelloWorld程序如何在手机上面调试运行
- Android开发-之第一个程序:HelloWorld!
- 我的第一个Android程序--HelloWorld
- 第一个android程序HelloWorld