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

标签 java android pseudocode

我正在尝试为 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/

相关文章:

c - 什么是 "for to by"循环?

algorithm - 为什么在 Dijkstra 算法中使用堆?

java - Android SharedPreferences 似乎不起作用

java - Liferay 搜索与附件术语匹配的结构化网页内容

java - Mockito doAnswer 因未知原因抛出 InvalidUseOfMatchersException

java - 安卓应用程序 :Overwriting file instead of appending

algorithm - 如何平移和缩放边界框内的点?

Java 监视服务 : Not Working for Remote Files mounted in the local Server

java - 如何在spring mvc中的servlet xml文件中导入xml文件

android - 后退按钮时 fragment 错误