gpt4 book ai didi

java - 为 Android 应用程序编写伪代码

转载 作者:行者123 更新时间:2023-12-01 18:36:19 27 4
gpt4 key购买 nike

我正在尝试为 Android GPS 应用程序示例编写伪代码,我知道没有标准,但是这样做可以接受吗?或者有更好、更清晰的方法吗?

Define class MainActivity inherits Android Activity class and implements LocationListener interface
MainActivity Start
Override the void onCreate method of Activity class
start
set the buttons of the main screen layout:
do
set 'my point button' to start GeoLocation class
set 'settings button' to start Settings class
set 'address button' to start My Address class
set 'Help image_button' to start Help class
done
End

Override the void onResume method of Activity class
start
request Location Updates every 5 seconds
end
// and so on

那么表示 Activity 生命周期又如何呢?可以这样表示吗?

when the activity created
do ...........
done
when the activity Resumed
//and so on

然后我将编写其他类

谢谢

最佳答案

我不知道您是在编写伪代码,还是只是以更详细的方式编写 Java 代码。

而不是写类似的东西

@Override
public void onResume() {
...
}

你写

Override the void onResume method of Activity class
start
request Location Updates every 5 seconds
end

与从头开始编写 Java 代码相比,这样做有什么优势?

更加抽象。

关于java - 为 Android 应用程序编写伪代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21855246/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com