MPC Practical 4
MPC Practical 4
Faculty of Technology
Department of Information and Communication Technology
Subject: Mobile and Pervasive Aim: Develop an application for multimedia processing. The app will allow
Computing [01CT0716] users to choose or capture an image and display the image as well as details
of it like size and dimensions..
Practical No: 4 Date: 19-09-2024 Enrollment No: - 92210133009
CODE:-
MainActivity.kt:-
btnPickImage.setOnClickListener {
pickImageFromGallery()
}
btnCaptureImage.setOnClickListener {
captureImage()
}
checkPermissions()
}
ActivityCompat.requestPermissions(this, arrayOf(
Manifest.permission.CAMERA,
Manifest.permission.READ_EXTERNAL_STORAGE), 100)
1|Page
Marwadi University
Faculty of Technology
Department of Information and Communication Technology
Subject: Mobile and Pervasive Aim: Develop an application for multimedia processing. The app will allow
Computing [01CT0716] users to choose or capture an image and display the image as well as details
of it like size and dimensions..
Practical No: 4 Date: 19-09-2024 Enrollment No: - 92210133009
}
}
2|Page
Marwadi University
Faculty of Technology
Department of Information and Communication Technology
Subject: Mobile and Pervasive Aim: Develop an application for multimedia processing. The app will allow
Computing [01CT0716] users to choose or capture an image and display the image as well as details
of it like size and dimensions..
Practical No: 4 Date: 19-09-2024 Enrollment No: - 92210133009
<Button
android:id="@+id/btnPickImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Pick Image"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginTop="20dp"/>
<Button
android:id="@+id/btnCaptureImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Capture Image"
app:layout_constraintTop_toBottomOf="@+id/btnPickImage"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginTop="10dp"/>
<ImageView
android:id="@+id/imageView"
android:layout_width="300dp"
android:layout_height="300dp"
android:layout_marginTop="20dp"
app:layout_constraintTop_toBottomOf="@+id/btnCaptureImage"
app:layout_constraintStart_toStartOf="parent"
3|Page
Marwadi University
Faculty of Technology
Department of Information and Communication Technology
Subject: Mobile and Pervasive Aim: Develop an application for multimedia processing. The app will allow
Computing [01CT0716] users to choose or capture an image and display the image as well as details
of it like size and dimensions..
Practical No: 4 Date: 19-09-2024 Enrollment No: - 92210133009
app:layout_constraintEnd_toEndOf="parent"
android:scaleType="centerCrop" />
<TextView
android:id="@+id/textViewDetails"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Image Details"
app:layout_constraintTop_toBottomOf="@id/imageView"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginTop="20dp"/>
</androidx.constraintlayout.widget.ConstraintLayout>
Output:-
4|Page