简体   繁体   中英

Do I need to create fragments in this kind of condition?

I am confused whether I need to create a fragment in this situation or not. On main activity, I have a EditText field for taking city name as user input and a button below clicking which should display weather information from openweathermap.com's API current temperature, Wind Speed and Weather description along with a button that displays Latitude and Longitude on the same screen. Below the Submit city button. Clicking the button on latitude and longitude should display google map for that place along with markers displaying temperature.

Do I need to create fragment in this case? I think so but I am not sure. I am not able to start to code.

How if i create EditText for city input and submit button on activity and create the 3 text fields for weather and button displaying latitude and longitude on a fragment and another fragment to display map? Am i thinking the right way?

Could you help me with your knowledge?

Depends on whether you want to support for tablets or not?

If not then you don't need fragments since all the view groups are stacked vertically.

您可以在MainActivity中执行此操作,并且不需要片段。当您按下提交按钮时,您可以在必要时重新启动活动。在这种情况下,实际上并不需要使用片段,但是如果您愿意,也可以使用片段。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM