- 전체
- android studio
- Android SDK
- Android NDK
- Android ADK
- Android Etc. Lib.
- Android dalvik VM
- Android 보안
- PhoneGap
- AOSP 개발
- MIT App Inventor 2
- kivy (python)
- ionic framework
- Kotlin (코틀린)
- React Native
MIT App Inventor 2 JSON data on the Android mobile with App Inventor 2
2016.02.17 21:54
JSON data on the Android mobile with App Inventor 2
Recently I have been experimenting with MIT app inventor 2 on the Web to check the development cycle and production time. It turns out that the platform is extremely productive and offers numerous features for Android app development.
In a day I have been able to develop a relatively simple app and in two hours I have produced a second version (had to include some error control).
THE APP SCENARIO
The app reads JSON data from a web server (user’s choice) and presents them in a typical listview. Each item in the list is clickable and activates a secondary screen with detailed info and social sharing functionality. This app scenario can be applied in numerous cases where various data or measurements are online and need to be presented in mobile devices.
THE CASE STUDY
The case study for this app development was eHealth. I have already developed an eHealth app for iOS and I wanted to see how this app could be developed for Android.
THE DEVELOPMENT PLATFORM
I have been experimenting with Android development for some years and I had to stick with the typical Eclipse-Andoid SDK solution. I did not yet had the time to experiment with the MIT app inventor platform so since the 2nd version has been made available this was a good time to do it. The rest of this post includes details on how to develop an app with the specified scenario on the app inventor 2 platform and publish it easily on Google Play Store.
HERE GOES
Lets suppose we have an app inventor account and we are already logged in.
We create a new project and give a name.
What we need for our application scenario is 2 screens. One for a listview (master) and one for the details. Lets start by developing Screen1 as is the master screen named by default.
Here is a complete view of the master screen and the components included:
Pin It
The interface is a typical visual programming interface with Components and Properties and is extremely easy and intuitive, so there is no need to explain anything more here. All components have been dragged-dropped from the Palette on the left side under the tabs “User Interface”, “Layout” and “Connectivity”.
Moving to the Blocks section (top-right screen button) we are able to do the actual programming using the Scratch Programming paradigm.
First of all we have to define some Global Variables for easy access throughout the app:
Pin It
Then we move on to define the main app procedure, what we need our app to do:
Pin It
Ok we are now done with this simple app and we just need to define what goes on in various cases that something happens, i.e. to handle the events in this app.
First we need to define what happens when the app loads:
Pin It
Then we define that at each Timer tick we want to check new JSON data from the server in case the user needs to get live feed of the data:
Pin It
In addition, we have to define what happens when the user uses the controls (the Go button and the live checkbox):
Pin It
Two more things need to be defined: what happens in case of errors, and what happens in case the user clicks on a list item:
Pin It
Pin It
It should be noted that the Detail Screen (the 2nd screen in this project) has already been defined and named as “DetailScreen”.
The final touch is to program what happens when the app receives JSON data from the server and how the listView is actually populated:
Pin It
It should also be noted that the JSON parsing algorithm presented in the previous figure is valid only for JSON data in the form shown in the following figure and should be carefully changed in other cases:
Pin It
This concludes the Master Screen named “Screen1”.
We then move to develop the Detail Screen named here “DetailScreen”.
Here is a complete view of the master screen and the components included:
Pin It
Again, there is no need to go into detail, since the Properties are more than obvious. Only one explanation that the “Share” and “Tweet” images are typical Buttons with their face changed using images.
Lets move to the “Blocks” section, again and take a look at the programming.
Here is the definition of Global Variables and the main Procedures:
It should be noted that the “get start value” Component is what the Master Screen passes to this Screen, and the the main Procedure creates a simple listView with the passed data from Master Screen and some additional data (here just some mobile device sensor data for reference).
Here are the Screen initialization methods, including what happens when the user requires to return to the Master Screen (presses “back”):Pin It
Please note that the CustomerKey and CustomerSecret are to be defined by each developer.
Here are the Social Media methods:
Pin It
And finally a simple error handling method:
Pin It
[출처] http://georgepavlides.info/json-data-on-the-android-mobile-with-app-inventor-2/
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
댓글 0
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
|---|---|---|---|---|
| 12 |
App Inventor - MySQL interface 앱 인벤터 mysql 연결
| 졸리운_곰 | 2018.04.07 | 7995 |
| 11 |
Connect App Inventor to MySQL Database 앱 인벤터와 mysql 데이터베이스 연결
| 졸리운_곰 | 2018.04.07 | 7273 |
| 10 |
Create an API (PHP) 앱 인벤터와 php 통합
| 졸리운_곰 | 2018.04.07 | 630 |
| 9 |
Using the WebViewer Control in App Inventor 앱인터에서 웹뷰 컨트롤 사용
| 졸리운_곰 | 2018.03.24 | 512 |
| 8 |
WebView Javascript Processor for App Inventor 앱 인벤터 웹뷰 자바스크립트 인터페이스
| 졸리운_곰 | 2018.03.24 | 505 |
| 7 |
Creating a digital wallet application in App Inventor 2
| 졸리운_곰 | 2017.05.01 | 287 |
| 6 | Creating a Custom TinyWebDB Service | 졸리운_곰 | 2016.05.18 | 201 |
| 5 |
TinyDB is a lightweight document oriented database
| 졸리운_곰 | 2016.05.16 | 270 |
| 4 |
구글 앱엔진에 의한 소형웹데이터베이스의 접속방법 tinywebdb
| 졸리운_곰 | 2016.05.15 | 547 |
| 3 |
App inventor 멀티스크린, 스크린 이동, 다중화면,
| 졸리운_곰 | 2016.02.17 | 779 |
| 2 |
Communicating with Web APIs
| 졸리운_곰 | 2016.02.17 | 1080 |
| » |
JSON data on the Android mobile with App Inventor 2
| 졸리운_곰 | 2016.02.17 | 364 |

