问题
In browser based web application(java), UI pages are served from web server . For example :- JSP are converted to HTML and then sent back to browser.
How does it work in Android Mobile Application ? Say i have a some mobile application whose home page has Employee Detail button. When i click on this button , I should be navigated to new UI page(say Detail page) which should displays employee details.
Mine understanding :- On server side there will be restful API that will receive the http request and send the just Employee details in form of json. It will not send any UI page. UI page(detail page) should already present inside mobile app. Now when i click the get detail button, i will be navigated to detail page . Now android API will fill data i received from server in to that page. Is this correct ?
回答1:
On server side there will be restful API that will receive the http request and send the just Employee details in form of json
It would not have to be JSON, though that is a typical response format for a Web service.
UI page(detail page) should already present inside mobile app
"Page" is not an appropriate noun here. Most GUIs do not use the term "page" for units of their user interface, as that is mostly used in Web apps. Desktop and mobile GUIs have other units of user interface: windows, screens, etc. In Android, the coarse unit of user interface is the Activity
.
But, terminology aside, you are correct that normally a mobile app has code that will take the Web service response and use that to display results to the user, by one means or another.
Now when i click the get detail button, i will be navigated to detail page .
How navigation works is up to you and can take many forms.
This is no different than in a Web app. In a Web app, when the user clicks a button, the user might go to a different Web page, or might not. In the latter case, JavaScript code in the existing Web page might make a Web service call and update the contents of the current page.
The same thing is true for desktop and mobile programs.
Now android API will fill data i received from server in to that page
Some programmer's code will take data that the code received from the Web service and use that in the user interface, by one means or another.
来源:https://stackoverflow.com/questions/40576689/browser-based-web-app-vs-mobile-app