java, javafx, android, spring programing collection and Age of Empires 4
java standard edition
addObject
arraylist
bufferedreader
colors
comparator
createTable
datatypes
date
enum
generateHTML
hashmap
inheritance
insertSQL
interface
JSONfromWEB
jsoup
list
loop
pointMatrix
queue
readCSV
regex
sqlToObject
stack
static
super
treemap
updateTable
writeCSV
java FX
3DCharacterMoving
3DMaterialList
DroneMotor
FlowPane
Hello
KeyCode
KeyMovement
ObservableList
Pane
RotateImage
rotateSphere
android
APIview
listview
ToastTimer
touchMovement
WriteReadFile
spring framework
add2Numbers
HelloWorld
RESTful
TomcatServlet
java objects
Apple
starseite
/
lessons
/
se
fx
android
spring
/
star wars api
ObservableList
2022-06-17 21:24:43
tags:
fx
observablelist
lessons
view source
KeyMovement
2022-06-17 07:51:04
tags:
fx
keycode
view source
KeyCode
2022-06-17 07:50:57
tags:
fx
keycode
view source
Pane
2022-06-17 07:48:48
tags:
fx
pane
view source
FlowPane
2022-06-17 07:48:41
tags:
fx
pane
view source
RotateImage
2022-06-17 07:48:25
tags:
fx
transition
view source
rotateSphere
2022-06-17 07:47:56
tags:
fx
oop.3D
view source
DroneMotor
2022-06-15 18:15:45
drone motor control simulator
tags:
fx
view source
3DMaterialList
2022-06-14 17:34:03
tags:
fx
oop
3D
view source
3DCharacterMoving
2022-06-14 17:33:59
tags:
fx
oop
3D
view source
Hello
2022-06-14 16:45:47
tags:
fx
view source
APIview
screenshot
description
source code
import android.widget.*; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; import java.util.LinkedList; import java.util.List; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LinearLayout layout = new LinearLayout(this); layout.setOrientation(LinearLayout.VERTICAL); ScrollView scrollView = new ScrollView(this); for (Character item : getObjectList()) { Button buttonName = new Button(this); buttonName.setText(item.getName()); System.out.println(item.getName()); layout.addView(buttonName); } scrollView.addView(layout); setContentView(scrollView); } public List
getObjectList() { List
characterList = new LinkedList
(); new Thread(new Runnable() { public void run() { String json = ""; try { URL url = new URL("https://cybershit.io/api/service.php?info=allcharacter"); HttpURLConnection con = (HttpURLConnection) url.openConnection(); InputStream inputStream = con.getInputStream(); try(BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) { json = reader.readLine(); } } catch (IOException e) { e.printStackTrace(); } JSONArray jsonArray = null; try { jsonArray = new JSONArray(json); } catch (JSONException e) { throw new RuntimeException(e); } int i = 0; JSONObject o = null; while (i <= jsonArray.length()-1) { try { o = jsonArray.getJSONObject(i); } catch (JSONException e) { throw new RuntimeException(e); } try { characterList.add(new Character(o.getString("name"))); } catch (JSONException e) {throw new RuntimeException(e); } i++; } } }).start(); try { Thread.sleep(5000); } catch(InterruptedException ex) {} return characterList; } } class Character { String name; Character(String name) { this.name = name; } public String getName() { return name; } }