初次提交
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="gen"/>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Sample2_7</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -0,0 +1,12 @@
|
||||
#Fri Jul 01 08:06:54 CST 2011
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0" package="com.bn.pp7">
|
||||
<application android:icon="@drawable/icon" android:label="@string/app_name">
|
||||
<activity android:name=".Sample2_7_Activity"
|
||||
android:label="@string/app_name">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
</application>
|
||||
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,9 @@
|
||||
Android一词的本义指“机器人”,同时也是Google于2007年11月5日宣布的基于Linux平台的开源手机操作系统的名称。该平台由操作系统、中间件、用户界面和应用软件组成,号称是首个为移动终端打造的真正开放和完整的移动软件。
|
||||
平台的开放性,应用程序间的平等性,无界限、快速方便的应用程序开发,不管是给用户还是给应用程序开发人员,都带来了全新的体验。
|
||||
Android是一个真正意义上的开放性移动开发平台,其不仅仅包含上层的用户界面和应用程序,还包括底层的操作系统。所有的Android应用程序都运行在虚拟机上,程序之间是完全平等的,用户可以随意将第三方软件置换掉系统自带的系统软件。
|
||||
一个应用程序不但可以通过API访问系统提供的功能,还可以声明自身的功能供其他应用程序调用。同时Android为开发人员提供了大量的适用库和工具,使得开发人员可以快速创建自己的应用程序。
|
||||
2010年5月27日手机广告公司AdMob发表报告称:中国市场上Android手机销量超过苹果iPhone。而在仅仅的2个月后《福布斯》杂志网络版周二刊文指出Android手机销量将达到iPhone销量的3倍。
|
||||
另一方面,Android更加贴近中国公民的购买力,Android为不同层次的消费群体量身定做了属于他们的产品。而软件方面,Android的软件从无到有,在到现在几乎所有的手机软件都能找到Android版本。Android在中国市场的脚步越走越快。
|
||||
中国拥有全世界最多的人口,中国的经济发展速度如日中天,得中国市场就得到了天下五分之一的市场,Android在中国正在阔步前进,未来一片光明。
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,11 @@
|
||||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system use,
|
||||
# "build.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
|
||||
# Project target.
|
||||
target=android-7
|
||||
@@ -0,0 +1,31 @@
|
||||
/* AUTO-GENERATED FILE. DO NOT MODIFY.
|
||||
*
|
||||
* This class was automatically generated by the
|
||||
* aapt tool from the resource data it found. It
|
||||
* should not be modified by hand.
|
||||
*/
|
||||
|
||||
package com.bn.pp7;
|
||||
|
||||
public final class R {
|
||||
public static final class attr {
|
||||
}
|
||||
public static final class drawable {
|
||||
public static final int icon=0x7f020000;
|
||||
}
|
||||
public static final class id {
|
||||
public static final int Button01=0x7f050003;
|
||||
public static final int EditText01=0x7f050002;
|
||||
public static final int EditText02=0x7f050005;
|
||||
public static final int LinearLayout01=0x7f050000;
|
||||
public static final int ScrollView01=0x7f050004;
|
||||
public static final int TextView01=0x7f050001;
|
||||
}
|
||||
public static final class layout {
|
||||
public static final int main=0x7f030000;
|
||||
}
|
||||
public static final class string {
|
||||
public static final int app_name=0x7f040001;
|
||||
public static final int hello=0x7f040000;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.0 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
@@ -0,0 +1,53 @@
|
||||
<?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:text="文件IO--读取Assets文件"
|
||||
android:layout_width="fill_parent"
|
||||
android:textSize="16dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
/>
|
||||
<LinearLayout
|
||||
android:id="@+id/LinearLayout01"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:text="文件名:"
|
||||
android:textSize="18dip"
|
||||
android:id="@+id/TextView01"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
</TextView>
|
||||
<EditText
|
||||
android:text="AndroidIO.txt"
|
||||
android:id="@+id/EditText01"
|
||||
android:singleLine="true"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
</EditText>
|
||||
<Button
|
||||
android:text="打开文件"
|
||||
android:id="@+id/Button01"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
</Button>
|
||||
</LinearLayout>
|
||||
<ScrollView
|
||||
android:id="@+id/ScrollView01"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<EditText
|
||||
android:text=""
|
||||
android:id="@+id/EditText02"
|
||||
android:editable="false"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
</EditText>
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="hello">Hello World, Sample3_3_Activity!</string>
|
||||
<string name="app_name">Sample2_7</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.bn.pp7;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.InputStream;
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class Sample2_7_Activity extends Activity {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) { //重写onCreate方法
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.main); //设置layout
|
||||
Button ok=(Button)this.findViewById(R.id.Button01); //获取打开Button
|
||||
ok.setOnClickListener //为打开按钮添加监听器
|
||||
( new OnClickListener()
|
||||
{ public void onClick(View v)
|
||||
{
|
||||
EditText et1=(EditText)findViewById(R.id.EditText01);
|
||||
//调用loadText方法获取对应文件名的文件
|
||||
String nr=loadText(et1.getText().toString().trim());
|
||||
EditText et2=(EditText)findViewById(R.id.EditText02);
|
||||
//设置显示框内容
|
||||
et2.setText(nr);
|
||||
}});}
|
||||
public String loadText(String name) //加载assets文件方法
|
||||
{ String nr=null; //内容字符串
|
||||
try
|
||||
{ //打开对应名称文件的输入流
|
||||
InputStream is=this.getResources().getAssets().open(name);
|
||||
int ch=0;
|
||||
//创建字节数组输出流
|
||||
ByteArrayOutputStream baos=new ByteArrayOutputStream();
|
||||
while((ch=is.read())!=-1)
|
||||
{ baos.write(ch); } //读取文件
|
||||
byte[] buff=baos.toByteArray(); //转化为字节数组
|
||||
baos.close(); //关闭输入输出流
|
||||
is.close(); //关闭输入输出流
|
||||
nr=new String(buff,"utf-8"); //转码生产新字符串
|
||||
nr=nr.replaceAll("\\r\\n","\n"); //替换换行符等空白字符
|
||||
} catch (Exception e)
|
||||
{ //没有找到对应文件,进行提示
|
||||
Toast.makeText(getBaseContext(), "对不起,没有找到指定文件。", Toast.LENGTH_LONG).show(); }
|
||||
return nr; //返回内容字符串
|
||||
}}
|
||||
Reference in New Issue
Block a user