Skip to content

Commit

Permalink
First Commit for HelloNewWorld Project
Browse files Browse the repository at this point in the history
  • Loading branch information
smartgang committed Dec 21, 2011
0 parents commit 0bd8340
Show file tree
Hide file tree
Showing 29 changed files with 240 additions and 0 deletions.
7 changes: 7 additions & 0 deletions HelloNewWorld/.classpath
Original file line number Diff line number Diff line change
@@ -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/classes"/>
</classpath>
33 changes: 33 additions & 0 deletions HelloNewWorld/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>HelloNewWorld</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>
17 changes: 17 additions & 0 deletions HelloNewWorld/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yarin.Android.HelloAndroid"
android:versionCode="1"
android:versionName="1.0">
<application android:label="@string/app_name" android:icon="@drawable/icon">
<activity android:label="@string/app_name" android:name=".HelloNewWorld">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Activity02"></activity>
</application>

<uses-sdk android:minSdkVersion="10"></uses-sdk>
</manifest>
Binary file added HelloNewWorld/bin/HelloNewWorld.apk
Binary file not shown.
Binary file added HelloNewWorld/bin/classes.dex
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.
Binary file added HelloNewWorld/bin/res/drawable-hdpi/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added HelloNewWorld/bin/res/drawable-ldpi/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added HelloNewWorld/bin/res/drawable-mdpi/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added HelloNewWorld/bin/resources.ap_
Binary file not shown.
36 changes: 36 additions & 0 deletions HelloNewWorld/proguard.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService

-keepclasseswithmembernames class * {
native <methods>;
}

-keepclasseswithmembernames class * {
public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembernames class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}

-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
11 changes: 11 additions & 0 deletions HelloNewWorld/project.properties
Original file line number Diff line number Diff line change
@@ -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,
# "ant.properties", and override values to adapt the script to your
# project structure.

# Project target.
target=android-10
Binary file added HelloNewWorld/res/drawable-hdpi/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added HelloNewWorld/res/drawable-ldpi/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added HelloNewWorld/res/drawable-mdpi/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions HelloNewWorld/res/layout/main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?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"
/>
<Button
android:layout_height="wrap_content"
android:id="@+id/button1"
android:text="切换到2"
android:layout_width="100px"
android:layout_x="100px"
android:layout_y="80px"
>
</Button>
</LinearLayout>
22 changes: 22 additions & 0 deletions HelloNewWorld/res/layout/mainactivity.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?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/hello2"
>
</TextView>
<Button
android:id="@+id/button2"
android:layout_width="100px"
android:layout_height="wrap_content"
android:layout_x="100px"
android:layout_y="80px"
android:text="切换到1"
>
</Button>
</LinearLayout>
6 changes: 6 additions & 0 deletions HelloNewWorld/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello World, HelloNewWorld!</string>
<string name="app_name">HelloNewWorld</string>
<string name="hello2">The Second Activity</string>
</resources>
37 changes: 37 additions & 0 deletions HelloNewWorld/src/com/yarin/Android/HelloAndroid/Activity02.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.yarin.Android.HelloAndroid;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.content.Intent;
import android.view.View;
//import android.view.View.OnClickListener;
import android.widget.Button;


public class Activity02 extends Activity{

static final String TAG2 ="HelloNewWorld2";

public void onCreate(Bundle savedInstanceState){
Log.e(TAG2,"Creat2");
super.onCreate(savedInstanceState);
//Show the view of activity2 which is defined in mainactivity.xml
Log.e(TAG2,"Layout2");
setContentView(R.layout.mainactivity);
//根据ID编号从布局文件mainactivity中获取按键
Button button=(Button)findViewById(R.id.button2);

button.setOnClickListener(new Button.OnClickListener(){
public void onClick(View v){
Intent intent=new Intent();

intent.setClass(Activity02.this,HelloNewWorld.class);

startActivity(intent);

Activity02.this.finish();
}
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.yarin.Android.HelloAndroid;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;


public class HelloNewWorld extends Activity {

/* 定义TAG标签,打印调试日志*/
static final String TAG ="HelloNewWorld";


/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
/*打印Log信息*/
Log.v(TAG,"VERBOSE");
Log.d(TAG,"DEBUG");
Log.i(TAG,"INFO");
Log.w(TAG,"WARN");
Log.e(TAG,"ERROR");

setContentView(R.layout.main);

Button button=(Button)findViewById(R.id.button1);

button.setOnClickListener(button1);
}
private OnClickListener button1=new OnClickListener() {
public void onClick(View v)
{
/* 新建一个Intent对象 */
Intent intent = new Intent();
/* 指定intent要启动的类 */
intent.setClass(HelloNewWorld.this, Activity02.class);
/* 启动一个新的Activity */
startActivity(intent);
/* 关闭当前的Activity */
HelloNewWorld.this.finish();
}
};
}


0 comments on commit 0bd8340

Please sign in to comment.