編輯:關於Android編程
package cn.android.intent; import java.util.Date; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.KeyEvent; import android.view.View; import android.widget.TextView; public class NewActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.other); Intent intent = getIntent(); //Log.i("NewActivity", intent.getData().getPath()); String title = intent.getStringExtra("title"); double since = intent.getDoubleExtra("since", 1995.5); TextView textView = (TextView) this.findViewById(R.id.textView); textView.setText("語言:" + title + ",發布時間:" + since + "。"); } public void closeActivity(View v) { Intent intent = new Intent(); intent.putExtra("result", new Date().toString()); setResult(501, intent); this.finish(); } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { closeActivity(null); } return true; } }
package cn.android.intent; import java.util.Date; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.KeyEvent; import android.view.View; import android.widget.TextView; public class NewActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.other); Intent intent = getIntent(); //Log.i("NewActivity", intent.getData().getPath()); String title = intent.getStringExtra("title"); double since = intent.getDoubleExtra("since", 1995.5); TextView textView = (TextView) this.findViewById(R.id.textView); textView.setText("語言:" + title + ",發布時間:" + since + "。"); } public void closeActivity(View v) { Intent intent = new Intent(); intent.putExtra("result", new Date().toString()); setResult(501, intent); this.finish(); } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { closeActivity(null); } return true; } }
Hello World, MainActivity! New Activity! Android意圖 打開顯示意圖 打開隱式意圖 關閉窗口
本文講介紹android在3.0之後推出的一種新的動畫機制,屬性動畫,對動畫不了解的同學,可以先去看看繪圖篇——android動畫基礎這篇文章。好
前言:為了使ListView性能更優,最普遍的方法就是添加一個ViewHolder靜態類。雖然性能有很大的提高,但是同樣也伴隨著Item控件內容顯示重復或錯亂的情況。&n
Android的設置界面實現比較簡單,有時甚至只需要使用一個簡單的xml文件即可.聲明簡單,但是如何從PreferenceScreen或者PreferenceCatego
一、申請你的AppIDhttp://open.weixin.qq.com/ 友情提示:推薦使用eclipse打包軟件最後一步的MD5值去申請AppID二、官網