博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Head Fisrt Android Development读书笔记(7)Multi Screep Apps
阅读量:5289 次
发布时间:2019-06-14

本文共 1760 字,大约阅读时间需要 5 分钟。

 

Screen Navigation

1.Create a new Activity and configure it to use a new Layout

2.Create an Intent

3.Call startActivity or startActvityForResult to launch a new screen

4.onActivityResult to deal with data result from launched activity

 

New Menu Steps

1.Create a new menu XML file from the new XML file wizard

2.Add menu items

3.Inflate the menu using the MenuInflater in the onCreateOptionsMenu method in your activity /// getMenuInflater();

4.Process the menu action in onMenuItemSelected in your activity.

 

 

startActivity & Intent

Android maintains a stack of Activities your app has started, beginning with the first Activity in your app. As you start new Activtities like you did with the time entry screen, it's automatically added to the back of Activities.

 

Intent is an abstracted description of an operation to be performed. It can be used with startActivtiy to launch an Activity

 

Intent intent = new Intent(this, AddTimeActivity.class); // from , to

Intent intent = getIntent() calling getIntent() retrieves the starting intent from a running Activity.

intent.putExtra("time", ....)

this.setResult(RESULT_OK, intent);

 

call finish() to complete a screen and automatically display the previous screen on the back stack

startActivityForResult

 

 

EditText

use EditText for text entry

  <EditText ... />

 

Menu

/res/menu for menu layout

 

activity onCreateOptionsMenu()

 

public void onCreateOptionsMenu(Menu m) {

 super.onCreateOptionsMenu(m);

 MenuInflater menuInflater = getMenuInflatter();

 menuInflater.inflate(R.menu.time_list_menu, menu);

}

 

capture the menu action: onMenuItemSelected

Adapter

adapter.notifyDataSetChanged(); this method let list know the data has changed and update the diaplay

 

 

 

转载于:https://www.cnblogs.com/java20130722/archive/2012/10/19/3206866.html

你可能感兴趣的文章
使用http-server开启一个本地服务器
查看>>
FineUIMvc随笔(3)不能忘却的回发(__doPostBack)
查看>>
Python【每日一问】04
查看>>
php CI框学习整理
查看>>
使用Netty,我们到底在开发些什么?
查看>>
hihocoder #1456 : Rikka with Lattice(杜教筛)
查看>>
基础数论复习
查看>>
Codeforces Round #429 (Div. 1) C. On the Bench(dp + 组合数)
查看>>
01.C#数据类型、排序、过滤(一章1.1-1.2)
查看>>
C++(笔)002
查看>>
js css3实现钟表效果
查看>>
Poj2795Exploring PyramidsDp
查看>>
Js实现截图功能
查看>>
display:none和visibility:hidden的区别
查看>>
web标准
查看>>
面向过程,面向对象各自优缺点
查看>>
How.To.Process.Image.Infomation.Of.Rotate.And.Flip.From.Server
查看>>
【HTML5】Web存储
查看>>
js实现拖动div,兼容IE、FireFox,暂不兼容Chrome
查看>>
把Visionpro的控件如何加载到VS中去
查看>>