zoukankan      html  css  js  c++  java
  • Head Fisrt Android Development读书笔记(7)Multi Screep Apps

    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
     


     


     

  • 相关阅读:
    P1215 [USACO1.4]母亲的牛奶 Mother's Milk
    P2966 [USACO09DEC]牛收费路径Cow Toll Paths
    P2419 [USACO08JAN]牛大赛Cow Contest
    1085 数字游戏
    P1983 车站分级
    P1346 电车(dijkstra)
    P1196 银河英雄传说(加权并查集)
    P1195 口袋的天空
    3027 线段覆盖 2
    codevs 1214 线段覆盖/1643 线段覆盖 3
  • 原文地址:https://www.cnblogs.com/java20130722/p/3206866.html
Copyright © 2011-2022 走看看