package com.example.myanimbeta import android.content.ActivityNotFoundException import android.content.Intent import android.os.Bundle import android.provider.MediaStore import android.view.View import android.widget.TextView import android.widget.Toast import androidx.appcompat.app.AppCompatActivity import kotlin.math.roundToInt class ActivityResult : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_result) val intent = getIntent() val name = intent.getStringExtra("Name") val mark = intent.getIntExtra("Mark", 0) val points = intent.getFloatExtra("Points", 0.0f) val complete = intent.getBooleanExtra("Complete", false) val max_points = 50 val resultTV: TextView = findViewById(R.id.result_textview) resultTV.text = "Name: " +name+ "\n" + "Mark: " +mark+ "\n" + "Points: " +points+ "(" + (points/max_points*100).roundToInt() + "%)\n" + "Program Complete: " +complete+"\n" } fun onTakeAPhotoClick(view: View) { val takePhotoIntent = Intent(MediaStore.ACTION_IMAGE_CAPTURE) try { startActivity(takePhotoIntent) } catch (e: ActivityNotFoundException) { Toast.makeText(this, "Photo ERROR!", Toast.LENGTH_SHORT).show() } } }