Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
//java client
OutputStream output = client.getOutputStream();
DataOutputStream out = new DataOutputStream(new BufferedOutputStream(output));
byte[] msg;
if(strings[1].equals("swipe"))
{
out.write(strings[1].getBytes());
out.flush();
//strings[0] contains the movement information in format of:
//xmovement_ymovement
//for example: 2.5365_8.5478
msg = strings[0].getBytes();
out.write(msg);
out.flush();
}
#python server
#the 1024 is a temporary number I just put in there
#because I don't know how to find the size of the data in the java client side
request_byte = client_socket.recv(1024)
print("reqeust_byte size: " + str(sys.getsizeof(request_byte)))
request = request_byte.decode()
print("Received " + request)
if request == "swipe":
movement_byte = client_socket.recv(1024)
print("movement_byte size: " + str(sys.getsizeof(movement_byte)))
movement_str = movement_byte.decode()
x_movement, y_movement = movement_str.split("_")
print("x: " + x_movement)
print("y: " + y_movement)
swipe(float(x_movement), float(y_movement))

9/17/2019
6:03 AM * daemon not running; starting now at tcp:5037
6:03 AM * daemon started successfully
6:03 AM Gradle sync started with single-variant sync
6:03 AM Project setup started
6:03 AM Gradle sync finished in 3 s 989 ms (from cached state)
6:04 AM Executing tasks: [:app:generateDebugSources] in project C:\Users\Shelby\AndroidStudioProjects\JavaArrays
6:04 AM NDK Resolution Outcome: Project settings: Gradle model version=5.4.1, NDK version is UNKNOWN
6:04 AM Gradle build finished in 30 s 252 ms
6:08 AM Executing tasks: [:app:assembleDebug] in project C:\Users\Shelby\AndroidStudioProjects\JavaArrays
6:08 AM Emulator: dsound: Could not initialize DirectSoundCapture
6:08 AM Emulator: dsound: Reason: No sound driver is available for use, or the given GUID is not a valid DirectSound device ID
6:08 AM Emulator: dsound: Attempt to initialize voice without DirectSoundCapture object
6:08 AM Emulator: dsound: Attempt to initialize voice without DirectSoundCapture object
6:08 AM Emulator: audio: Failed to create voice `goldfish_audio_in'
6:08 AM Emulator: C:\Users\Shelby\AppData\Local\Android\Sdk\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe: warning: opening audio input failed
6:08 AM Emulator: dsound: Attempt to initialize voice without DirectSoundCapture object
6:08 AM Emulator: dsound: Attempt to initialize voice without DirectSoundCapture object
6:08 AM Emulator: audio: Failed to create voice `adc'
6:08 AM Emulator: dsound: Attempt to initialize voice without DirectSoundCapture object
6:08 AM Emulator: dsound: Attempt to initialize voice without DirectSoundCapture object
6:08 AM Emulator: audio: Failed to create voice `adc'
6:09 AM Gradle build finished in 17 s 347 ms
6:09 AM Install successfully finished in 566 ms.: App restart successful without requiring a re-install.
6:09 AM Executing tasks: [:app:assembleDebug] in project C:\Users\Shelby\AndroidStudioProjects\JavaArrays
6:09 AM Gradle build finished in 3 s 339 ms
6:09 AM Install successfully finished in 667 ms.: App restart successful without requiring a re-install.
package com.swayzeconstruction.javaarrays;
public class Main {
public static void main(String[] args) {
String[] names = new String[5];
names[0] = "Shelby";
names[1] = "Jaam";
names[2] = "Bisous";
names[3] = "Felix";
names[4] = "Hadi";
System.out.println(names[3]);
int[] numbers = new int[5]; //apparently gives all values of array
//or the following
}
{
String[] names2 = new String[5];
System.out.println(names2[2]); //gives second value of array
// or the following
}
{
String[] names3 = new String[5];
{
System.out.println(names3[2]);
int[] numbers = {1, 2, 3, 4, 5}; //note: using curly braces
System.out.println(numbers[1]); // to get second element
}
}
}