Created
September 28, 2012 08:10
-
-
Save dalang/3798581 to your computer and use it in GitHub Desktop.
For Android basic knowledge training in CRSCY
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="org.dalang.hello" | |
android:versionCode="1" | |
android:versionName="1.0" > | |
<uses-sdk android:minSdkVersion="10" /> | |
<application | |
android:icon="@drawable/ic_launcher" | |
android:label="@string/app_name" > | |
<activity | |
android:name=".HelloActivity" | |
android:label="@string/app_name" > | |
<intent-filter> | |
<action android:name="android.intent.action.MAIN" /> | |
<category android:name="android.intent.category.LAUNCHER" /> | |
</intent-filter> | |
</activity> | |
<activity | |
android:name=".Hello2Activity" | |
android:label="@string/app_name" > | |
<intent-filter> | |
<action android:name="org.dalang.hello.intent.action.ShowHello2" /> | |
<category android:name="android.intent.category.DEFAULT" /> | |
</intent-filter> | |
</activity> | |
</application> | |
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;op dest, src1, src2 | |
add a, b, c | |
;op dest, src | |
add a, b | |
;java byte code | |
iconst_1 | |
iconst_2 | |
iadd | |
istore_0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.dalang.hello; | |
import android.app.Activity; | |
import android.content.Intent; | |
import android.os.Bundle; | |
import android.util.Log; | |
import android.view.MotionEvent; | |
import android.widget.TextView; | |
public class HelloActivity extends Activity { | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
TextView tv = new TextView(this); | |
tv.setText("hello world" ); | |
setContentView(tv); | |
} | |
@Override | |
public boolean onTouchEvent(MotionEvent e) { | |
Log.v("TouchEventName", "" + e.getAction()); | |
switch (e.getAction()) { | |
case MotionEvent.ACTION_DOWN: | |
String actionName = "org.dalang.hello.intent.action.ShowHello2"; | |
Intent intent = new Intent(actionName); | |
this.startActivity(intent); | |
break; | |
default: | |
break; | |
} | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment