Getting started

本文深入讲解了Android平台上的应用开发技巧,包括如何使用Activity、Intent和SQLite,特别聚焦于多个Activity之间的参数传递和数据管理。文章还介绍了如何优化变量使用,并详细说明了在AndroidManifest.xml中定义新Activity的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

I spent a whole day to go through the second example of android ( Note book App). Basically, I can understand how to use Activity, Intent and SQLite in android platform already, but it's only a superficial level. For example : using multiple activities and transfering parameters among of them with Intent.

Below are some spots need to be advert:

  • startManagingCursor();

          It allows Android to take care of the Cursor lifecycle instead of us needing to worry about it

    private static final int INSERT_ID = Menu.FIRST;

    private static final int DELETE_ID = Menu.FIRST + 1;

   Be ware of that we need to increase the index number when we want to add new menu items

  • Optimization – How to use variables efficiently in android platform

   Finally, the new Activity has to be defined in the manifest file:

 

Before the new Activity can be seen by Android, it needs its own Activity entry in the AndroidManifest.xml file. This is to let the system know that it is there and can be called. We could also specify which IntentFilters the activity implements here, but we are going to skip this for now and just let Android know that the Activity is defined.There is a Manifest editor included in the Eclipse plugin that makes it much easier to edit the AndroidManifest file, and we will use this. If you prefer to edit the file directly or are not using the Eclipse plugin, see the box at the end for information on how to do this without using the new Manifest editor.

 

1.    Double click on the AndroidManifest.xml file in the package explorer to open it.
2.    Click the Application tab at the bottom of the Manifest editor.
3.    Click Add... in the Application Nodes section.
If you see a dialog with radiobuttons at the top, select the top radio button: "Create a new element at the top level, in Application".
4.    Make sure "(A) Activity" is selected in the selection pane of the dialog, and click OK.

  5.    Click on the new "Activity" node, in the Application Nodes section, then type .NoteEdit into the Name* field to the right. Press Return/Enter.

 

   The Android Manifest editor helps you add more complex entries into the AndroidManifest.xml file, have a look around at some of the other options available (but be careful not to select them otherwise they will be added to your Manifest). This editor should help you understand and alter the AndroidManifest.xml file as you move on to more advanced Android applications.

  •  Two different methods to transfer parameters among of activities
bundle
1 bundle.putString(NotesDbAdapter.KEY_TITLE, mTitleText.getText().toString());
2 bundle.putString(NotesDbAdapter.KEY_BODY, mBodyText.getText().toString());
3 ExpandedBlockStart.gifContractedBlock.gif if  (mRowId  !=   null {
4   bundle.putLong(NotesDbAdapter.KEY_ROWID, mRowId);
5}

6
7 Intent mIntent  =   new  Intent();
8 mIntent.putExtras(bundle);

Intent

1 Intent intent  =   new  Intent();
2 intent.putExtra(NotesDbAdapter.KEY_TITLE, mTitleText.getText().toString());
3 intent.putExtra(NotesDbAdapter.KEY_BODY, mBodyText.getText().toString());


 

 

转载于:https://www.cnblogs.com/EdgarSun/archive/2009/01/08/1372094.html

MCAL是Microcontroller Abstraction Layer的缩写,是一种用于微控制器开发的软件层。MCAL Getting Started Tutorial介绍了如何在MCAL平台上开始进行开发。 首先,在开始MCAL开发之前,我们需要了解MCAL的基本概念和特性。MCAL提供了一套抽象的API(应用程序编程接口),用于对底层硬件进行访问和控制。它的目的是将底层硬件和上层应用程序解耦,使得应用程序可以更方便地进行开发和移植。 接下来,我们需要安装所需的开发工具和环境。根据MCAL的厂商和平台的不同,安装过程也会有所差异。通常,我们需要安装MCAL的开发库、编译器、调试工具等。 安装完成后,我们可以开始编写第一个MCAL应用程序。在MCAL Getting Started Tutorial中,通常会提供一些示例代码和演示用例,以帮助我们理解MCAL的使用方法。我们可以按照教程的步骤来进行代码编写、编译和调试。 在编写MCAL应用程序时,我们需要了解MCAL提供的API和功能库。这些API和功能库包括了对GPIO、UART、SPI、I2C等外设的访问和配置接口,以及中断、时钟管理、内存管理等系统级功能。 最后,在编写和调试完成应用程序之后,我们可以将其下载到目标硬件上进行运行。为了确保应用程序的稳定性和性能,我们还可以进行性能分析和优化。 总的来说,MCAL Getting Started Tutorial为我们提供了一个学习和入门MCAL开发的入口。通过这个教程,我们可以掌握MCAL的基本概念、使用方法和开发流程,从而在微控制器开发中更高效地使用MCAL。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值