显示传递给 listview 的列表并将所选项目的 id 返回给上一个活动
我对 Android 开发相当陌生,我想制作一个简单的笔记应用程序作为学习练习。
我有一个带有编辑文本和菜单的活动。单击菜单时,我想显示第二个活动(或类似的活动),让用户选择一个注释,然后将其返回到要编辑的编辑文本。
到目前为止,我能找到的所有教程都使用硬编码列表或资源文件中的列表,我的教程必须更加动态。
非常感谢所有帮助,因为我想编码!
干杯,
威尔。
I am fairly new to Android development, and I would like to make a simple note-taking app as a learning exercise.
I have an activity with an edittext and a menu. when the menu is clicked I would like to display a second activity (or similar) that lets the user select a note that then is returned to the edittext to be edited.
So far all the tutorials I can find use a hard-coded list or a list in a resources file, mine has to be more dynamic.
All help is greatly appreciated as I want to get coding!
Cheers,
Will.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我不会给你完整的代码,因为你正在学习你应该自己探索它,但我想给你一些提示。
从第一个 Activity 开始,您应该使用 startActivityForResult 启动第二个 Activity,该 Activity 会启动一个 Activity,并且启动的 Activity 将返回一些结果到您的第一个活动。
您可以使用的另一件事是 PutExtra 它可用于传递一些数据活动到另一个。
I won't give you complete code as you are learning you should explore it yourself but I would like to give you some hints.
From your first Activity your should start second activity using startActivityForResult which starts an activity and that started activity will return some results to your first activity.
Another thing you can use is PutExtra which can be used for passing some data from one activity to another.
我会给你一个虚拟的方法
创建一个类
theApp
在清单中
(更改 android:name="theApp")在第一个活动中(返回到第二个活动):
在第二个活动中(返回第一个活动):
最后在第一个活动中
I will give you a dummy way
Create a class
theApp
In the manifest (change the android:name="theApp")
In the first activity (to return to the second activity):
In the second activity (to return to the first activity):
Finally in the first activity
我认为JavaNut13更关心他的列表中的视图而不是活动。
@JavaNut13,看看 http://thinkandroid.wordpress.com/2010 /01/13/自定义基础适配器/
I think JavaNut13 is more concerned about the views in his list and not activities.
@JavaNut13, take a look at http://thinkandroid.wordpress.com/2010/01/13/custom-baseadapters/