attempting to make tba request
This commit is contained in:
commit
0f4b5996e1
@ -1,6 +1,11 @@
|
||||
package com.example.scoutingapp;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
@ -8,7 +13,15 @@ import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class EndActivity extends AppCompatActivity {
|
||||
private String teamNumber, matchNumber, Taxiing, autoCoral, autoAlgea, floorPickup, HPPickup, startingLocation, teleopCoral, teleopAlgea, HPScore, teleopFloorPickup, Endgame, Climb, Notes;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@ -20,5 +33,38 @@ public class EndActivity extends AppCompatActivity {
|
||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||
return insets;
|
||||
});
|
||||
|
||||
Button submit = (Button) findViewById(R.id.Submit_button);
|
||||
submit.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
public void onClick(View view) {
|
||||
CSVmake(EndActivity.this);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
public String getTeamNumber() {
|
||||
teamNumber = "hello world";
|
||||
return teamNumber;
|
||||
}
|
||||
|
||||
public void CSVmake(Context context) {
|
||||
String CSVLine = teamNumber + "," + matchNumber + "," + Taxiing + "," + autoCoral + "," +
|
||||
autoAlgea + "," + floorPickup + "," + HPPickup + "," + startingLocation + "," +
|
||||
teleopCoral + "," + teleopAlgea + "," + HPScore + "," + teleopFloorPickup + "," +
|
||||
Endgame + "," + Climb + "," + Notes; //adds the strings the CSV file (if the strings have info)
|
||||
|
||||
File csvFile = new File(context.getExternalFilesDir(null), "match_data.csv");//makes the CSV file
|
||||
|
||||
try (FileWriter writer = new FileWriter(csvFile, true)) {//writes data to the file from CSVLine
|
||||
writer.append(CSVLine).append("\n");
|
||||
Log.d("CSVFilePath", csvFile.getAbsolutePath());
|
||||
} catch (IOException e) { //if it doesn't work it makes a toast and a log to tell you it didn't work
|
||||
Log.d("CSVFail", "CSV didn't make");
|
||||
Toast.makeText(this /* MyActivity */, "Failed to make server", Toast.LENGTH_SHORT).show();
|
||||
|
||||
};
|
||||
}
|
||||
}
|
@ -7,4 +7,13 @@
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".EndActivity">
|
||||
|
||||
<Button
|
||||
android:id="@+id/Submit_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/submit"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -1,3 +1,15 @@
|
||||
<resources>
|
||||
<string name="app_name">Scouting App</string>
|
||||
<string name="l1">L1</string>
|
||||
<string name="l2">L2</string>
|
||||
<string name="l3">L3</string>
|
||||
<string name="l4">L4</string>
|
||||
<string name="net">Net</string>
|
||||
<string name="next_hold">Next (Hold)</string>
|
||||
<string name="processor">Processor</string>
|
||||
<string name="can_leave">Can Leave</string>
|
||||
<string name="can_remove_algae">Can Remove Algae</string>
|
||||
<string name="coral_pickup">Coral Pickup</string>
|
||||
<string name="auto">Auto</string>
|
||||
<string name="image_of_field">Image of field</string>
|
||||
</resources>
|
Loading…
Reference in New Issue
Block a user