Android基础教程(六)之------- 参数的传递(Bundle)
摘要:Activity间的简单数据传递 Bundle 记录如下:1.建2个Activity 跳转2: 第一个文件 Intent intent = new Intent(); intent.setClass(Activity1.this,Activity2.class); //new一个Bundle对象,并将要传递的数据传入 Bundle bundle = new Bundle(); bundle.putDouble("height",height); bundle.putString("sex",sex); //将Bundle对象assign给Intent intent.putExtras(
阅读全文
posted @
2011-02-21 15:26
sunwei_07
阅读(513)
推荐(0)
Android基础教程(五)之 ------ ListView 的使用
摘要:LinearLayoutm_LinearLayout;ListViewm_ListView;/** Called when the activity is first created. */@Overridepublic void onCreate(Bundle savedInstanceState){super.onCreate(savedInstanceState);/* 创建LinearLayout布局对象 */m_LinearLayout = new LinearLayout(this);/* 设置布局LinearLayout的属性 */m_LinearLayout.setOrient
阅读全文
posted @
2011-02-17 19:27
sunwei_07
阅读(701)
推荐(0)
Android基础教程(五)之 ------ Andorid播放音频文件服务(MP3)
摘要:1.在raw目录放一个mp3文件:test.mp3;2.建一个MediaPlay的Service文件MusicService.javapublic class MusicService extends Service{//MediaPlayer对象private MediaPlayerplayer;public IBinder onBind(Intent arg0){return null;}public void onStart(Intent intent, int startId){super.onStart(intent, startId);//这里可以理解为装载音乐文件player =
阅读全文
posted @
2011-02-16 13:56
sunwei_07
阅读(698)
推荐(0)
Android基础教程(四)之------获取手机联系人信息
摘要:public void onCreate(Bundle savedInstanceState){TextView tv = new TextView(this);String string = "";super.onCreate(savedInstanceState);//得到ContentResolver对象 ContentResolver cr = getContentResolver(); //取得电话本中开始一项的光标 Cursor cursor = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, n
阅读全文
posted @
2011-02-16 13:23
sunwei_07
阅读(691)
推荐(0)
Android基础教程(三)之------ Activity 窗口切换
摘要:首先在layout里建2个xml文件分别有按钮1和按钮2JAVA代码:1.public class Activity01 extends Activity{public void onCreate(Bundle savedInstanceState){super.onCreate(savedInstanceState);/* 设置显示main.xml布局 */setContentView(R.layout.main);/* findViewById(R.id.button1)取得布局main.xml中的button1 */Button button = (Button) findViewByI
阅读全文
posted @
2011-02-16 09:25
sunwei_07
阅读(773)
推荐(0)
Android基础教程(二)之------更改手机窗口画面底色
摘要:1.string.xml<?xml version="1.0" encoding="utf-8"?><resources><string name="hello">Hello World, ActivityMain!</string><string name="app_name">ActivityMain</string><string name="name">账号:</string><string name="pass">密码:</string></resource
阅读全文
posted @
2011-02-15 16:12
sunwei_07
阅读(773)
推荐(0)
Android基础教程(一)之------更改与显示文字标签TextView标签的使用
摘要:首先我们是在res->values->string.xml里面加了如下一句(黑体):<?xmlversion="1.0"encoding="utf-8"?><resources><stringname="hello">HelloWorld,HelloAndroid</string><stringname="app_name">HelloAndroid</string><stringname="textView_text">欢迎来到博客</string></resources>
阅读全文
posted @
2011-02-15 16:09
sunwei_07
阅读(774)
推荐(1)