初次提交
This commit is contained in:
7
第2章 游戏开发基础知识/Sample2_3/.classpath
Normal file
7
第2章 游戏开发基础知识/Sample2_3/.classpath
Normal file
@@ -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>
|
||||
33
第2章 游戏开发基础知识/Sample2_3/.project
Normal file
33
第2章 游戏开发基础知识/Sample2_3/.project
Normal file
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Sample2_3</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>
|
||||
12
第2章 游戏开发基础知识/Sample2_3/.settings/org.eclipse.jdt.core.prefs
Normal file
12
第2章 游戏开发基础知识/Sample2_3/.settings/org.eclipse.jdt.core.prefs
Normal file
@@ -0,0 +1,12 @@
|
||||
#Fri Jul 01 08:01:10 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
|
||||
17
第2章 游戏开发基础知识/Sample2_3/AndroidManifest.xml
Normal file
17
第2章 游戏开发基础知识/Sample2_3/AndroidManifest.xml
Normal file
@@ -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.pp3">
|
||||
<application android:icon="@drawable/icon" android:label="@string/app_name">
|
||||
<activity android:name=".Sample2_3_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>
|
||||
BIN
第2章 游戏开发基础知识/Sample2_3/bin/Sample2_3.apk
Normal file
BIN
第2章 游戏开发基础知识/Sample2_3/bin/Sample2_3.apk
Normal file
Binary file not shown.
BIN
第2章 游戏开发基础知识/Sample2_3/bin/classes.dex
Normal file
BIN
第2章 游戏开发基础知识/Sample2_3/bin/classes.dex
Normal file
Binary file not shown.
BIN
第2章 游戏开发基础知识/Sample2_3/bin/com/bn/pp3/R$attr.class
Normal file
BIN
第2章 游戏开发基础知识/Sample2_3/bin/com/bn/pp3/R$attr.class
Normal file
Binary file not shown.
BIN
第2章 游戏开发基础知识/Sample2_3/bin/com/bn/pp3/R$drawable.class
Normal file
BIN
第2章 游戏开发基础知识/Sample2_3/bin/com/bn/pp3/R$drawable.class
Normal file
Binary file not shown.
BIN
第2章 游戏开发基础知识/Sample2_3/bin/com/bn/pp3/R$id.class
Normal file
BIN
第2章 游戏开发基础知识/Sample2_3/bin/com/bn/pp3/R$id.class
Normal file
Binary file not shown.
BIN
第2章 游戏开发基础知识/Sample2_3/bin/com/bn/pp3/R$layout.class
Normal file
BIN
第2章 游戏开发基础知识/Sample2_3/bin/com/bn/pp3/R$layout.class
Normal file
Binary file not shown.
BIN
第2章 游戏开发基础知识/Sample2_3/bin/com/bn/pp3/R$string.class
Normal file
BIN
第2章 游戏开发基础知识/Sample2_3/bin/com/bn/pp3/R$string.class
Normal file
Binary file not shown.
BIN
第2章 游戏开发基础知识/Sample2_3/bin/com/bn/pp3/R.class
Normal file
BIN
第2章 游戏开发基础知识/Sample2_3/bin/com/bn/pp3/R.class
Normal file
Binary file not shown.
BIN
第2章 游戏开发基础知识/Sample2_3/bin/com/bn/pp3/Sample2_3_Activity.class
Normal file
BIN
第2章 游戏开发基础知识/Sample2_3/bin/com/bn/pp3/Sample2_3_Activity.class
Normal file
Binary file not shown.
BIN
第2章 游戏开发基础知识/Sample2_3/bin/resources.ap_
Normal file
BIN
第2章 游戏开发基础知识/Sample2_3/bin/resources.ap_
Normal file
Binary file not shown.
11
第2章 游戏开发基础知识/Sample2_3/default.properties
Normal file
11
第2章 游戏开发基础知识/Sample2_3/default.properties
Normal file
@@ -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
|
||||
26
第2章 游戏开发基础知识/Sample2_3/gen/com/bn/pp3/R.java
Normal file
26
第2章 游戏开发基础知识/Sample2_3/gen/com/bn/pp3/R.java
Normal file
@@ -0,0 +1,26 @@
|
||||
/* 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.pp3;
|
||||
|
||||
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 TextView01=0x7f050000;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
BIN
第2章 游戏开发基础知识/Sample2_3/res/drawable-hdpi/icon.png
Normal file
BIN
第2章 游戏开发基础知识/Sample2_3/res/drawable-hdpi/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.0 KiB |
BIN
第2章 游戏开发基础知识/Sample2_3/res/drawable-ldpi/icon.png
Normal file
BIN
第2章 游戏开发基础知识/Sample2_3/res/drawable-ldpi/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
BIN
第2章 游戏开发基础知识/Sample2_3/res/drawable-mdpi/icon.png
Normal file
BIN
第2章 游戏开发基础知识/Sample2_3/res/drawable-mdpi/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
23
第2章 游戏开发基础知识/Sample2_3/res/layout/main.xml
Normal file
23
第2章 游戏开发基础知识/Sample2_3/res/layout/main.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<?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="Preferences操作"
|
||||
android:textSize="18dip"
|
||||
android:gravity="center"
|
||||
/>
|
||||
<TextView
|
||||
android:text=""
|
||||
android:id="@+id/TextView01"
|
||||
android:textColor="#000000"
|
||||
android:background="#ffffff"
|
||||
android:textSize="18dip"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
</TextView>
|
||||
</LinearLayout>
|
||||
5
第2章 游戏开发基础知识/Sample2_3/res/values/strings.xml
Normal file
5
第2章 游戏开发基础知识/Sample2_3/res/values/strings.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="hello">Hello World, Sample3_5_Activity!</string>
|
||||
<string name="app_name">Sample2_3</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.bn.pp3;
|
||||
|
||||
import java.util.Date;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class Sample2_3_Activity extends Activity {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) { //重写onCreate方法
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.main); //设置layout
|
||||
//获取SharedPreferences引用,存储名称为bn.xml,读写模式为私有
|
||||
SharedPreferences sp=this.getSharedPreferences("bn", Context.MODE_PRIVATE);
|
||||
String lastLoginTime=sp.getString("time", null);//获取键为“time”的值
|
||||
if(lastLoginTime==null) //若值为空,则为第一次登录本程序
|
||||
{ lastLoginTime="用户您好,欢迎您第一次光临本软件。"; }
|
||||
else //不为空,则修改字符串为上次登录时间
|
||||
{ lastLoginTime="用户您好,您上次进入时间为:"+lastLoginTime; }
|
||||
SharedPreferences.Editor editor=sp.edit(); //修改Preferences文件
|
||||
editor.putString("time", new Date().toLocaleString()); //修改键为“time”的值为当前时间
|
||||
editor.commit(); //提交修改
|
||||
TextView tv=(TextView)this.findViewById(R.id.TextView01); //获取用来显示的TextView
|
||||
tv.setText(lastLoginTime); //设置显示的字符串
|
||||
}}
|
||||
Reference in New Issue
Block a user