我从android.com获得了HelloListView应用程序,这是添加信息的最佳方式

时间:2022-10-22 20:16:02

I wanted to make an app that you can select a country and it comes up with information about the country. I don't know that much about Java i'm hoping that this will help me learn more about java.
I would like this to be an android app
please help me
thanks
CS

我想创建一个应用程序,您可以选择一个国家,它会提供有关该国家/地区的信息。我不太了解Java,我希望这能帮助我更多地了解Java。我想这是一个Android应用程序,请帮助我谢谢CS

edit: I am new to java so can you help me out and give me pointers on how to do this please.

编辑:我是java的新手,所以你可以帮助我,并指出如何做到这一点。

Example: Lets say we have a listview that has the United States, Germany, and the UK
I already have the list view set up. How would i go about making a second view that would let me select the us and give basic information about it?

示例:假设我们有一个包含美国,德国和英国的列表视图,我已经设置了列表视图。我将如何制作第二个视图,让我选择我们并提供有关它的基本信息?

2 个解决方案

#1


0  

Unfortunately I am still a little unclear as to what you are asking but as far as I am aware the list view you create should be able handle clicks on it, so if you check out the ListView class in the android SDK there you will need to look for the onClick event you are after. Overload it and put in the code to create (I think you are asking for this) a second activity, to then show your selection. However that might be a bit complex so try and handle the click event first by perhaps a toast message. Then work your way up.

不幸的是,我仍然有点不清楚你在问什么,但据我所知,你创建的列表视图应该能够处理它的点击,所以如果你检查android SDK中的ListView类,你需要寻找您追求的onClick事件。重载它并输入代码来创建(我想你要求这个)第二个活动,然后显示你的选择。然而,这可能有点复杂,所以尝试并首先通过toast消息处理click事件。然后继续努力。

The second activity you could use to show information, or just create a dialog, or another full screen view to show the info.

您可以用来显示信息的第二个活动,或者只是创建一个对话框,或者另一个全屏视图来显示信息。

#2


0  

I commend you for getting ListView to work without knowing Java. I would suggest you learn the language first before jumping into Android apps because the development resources assume that you have a good knowledge of the Java. There are lots of resources on the web for learning Java and you can do it all in the Eclipse environment if you wish.

我赞赏你让ListView在不知道Java的情况下工作。我建议你在进入Android应用程序之前首先学习语言,因为开发资源假定你对Java有很好的了解。 Web上有很多用于学习Java的资源,如果您愿意,您可以在Eclipse环境中完成所有这些工作。

Good luck!

#1


0  

Unfortunately I am still a little unclear as to what you are asking but as far as I am aware the list view you create should be able handle clicks on it, so if you check out the ListView class in the android SDK there you will need to look for the onClick event you are after. Overload it and put in the code to create (I think you are asking for this) a second activity, to then show your selection. However that might be a bit complex so try and handle the click event first by perhaps a toast message. Then work your way up.

不幸的是,我仍然有点不清楚你在问什么,但据我所知,你创建的列表视图应该能够处理它的点击,所以如果你检查android SDK中的ListView类,你需要寻找您追求的onClick事件。重载它并输入代码来创建(我想你要求这个)第二个活动,然后显示你的选择。然而,这可能有点复杂,所以尝试并首先通过toast消息处理click事件。然后继续努力。

The second activity you could use to show information, or just create a dialog, or another full screen view to show the info.

您可以用来显示信息的第二个活动,或者只是创建一个对话框,或者另一个全屏视图来显示信息。

#2


0  

I commend you for getting ListView to work without knowing Java. I would suggest you learn the language first before jumping into Android apps because the development resources assume that you have a good knowledge of the Java. There are lots of resources on the web for learning Java and you can do it all in the Eclipse environment if you wish.

我赞赏你让ListView在不知道Java的情况下工作。我建议你在进入Android应用程序之前首先学习语言,因为开发资源假定你对Java有很好的了解。 Web上有很多用于学习Java的资源,如果您愿意,您可以在Eclipse环境中完成所有这些工作。

Good luck!