I am currently trying to complete a revision test on Android Mobile Application Development and am stuck on a final question-

  1. The following code is part of an Activity that reads and writes data to a file stored on the device. The app should work with the lifecycle methods to make sure data is automatically stored and displayed. The code contains four common errors which you should highlight

Am I right in thinking the last two functions don't need to be protected? And that EditText and ListView should be elsewhere?

Any help would be appreciated.

Thanks

有帮助吗?

解决方案

i guess the following are the errors:

1) EditText is typecast into ListView which is illegal

2)The toast wouldn't show without .show() function in the end of makeText()

3 & 4) The onResume and onPause are public!

I am no expert, but I guess these are the errors most probably!

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top