Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Samenvatting

Summary Android programming sumary

Beoordeling
-
Verkocht
-
Pagina's
7
Geüpload op
08-03-2023
Geschreven in
2022/2023

we covered several topics related to Android app development. We discussed how to use Image and ImageButton in Android, with an example of how to set an image on an ImageButton using the android:src attribute. We also talked about using AlertDialog in Android, and provided an example of how to create a simple AlertDialog with a message and buttons. We then covered how to use AlarmManager service in Android, and provided an example of how to schedule an alarm to trigger at a specific time using the AlarmM method. Finally, we discussed how to use SMS service in Android. To send SMS messages, we can use the SmsManager class and the SmsMTextMessage method. To receive SMS messages, we can create a broadcast receiver that listens for the der.Telephony.SMS_RECEIVED broadcast intent.

Meer zien Lees minder
Instelling
Vak

Voorbeeld van de inhoud

ANDROID JAVA
ASSIGNMENT



Q1. How can use Image an Image Button
in Android.

Ans-

To use an ImageButton in Android, follow these steps:

Open your Android project in Android Studio.
Open the layout file where you want to add the ImageButton.
In the Design tab of the layout editor, drag and drop an ImageButton from the
palette onto your layout.
Select the ImageButton and look at the Properties panel on the right-hand side
of the layout editor.
In the Properties panel, find the srcCompat attribute and click on the ... button
next to it.
In the Resource Chooser dialog that appears, select the image you want to use
for the ImageButton and click OK.
If you want to add a tooltip to the ImageButton, find the tooltipText attribute
in the Properties panel and enter the text you want to use as the tooltip.
Customize the ImageButton as desired, such as adjusting its size, position, and
other properties.

Xml-
<ImageButton
android:id="@+id/my_image_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:srcCompat="@drawable/my_image"
android:contentDescription="My Image Button"
android:background="@android:color/transparent"
android:scaleType="centerInside"
android:padding="16dp"
android:onClick="myImageButtonClicked"
/>

, In this example, the ImageButton has an ID of my_image_button and uses an
image resource named my_image for its srcCompat attribute. It also has a
contentDescription attribute, which is used to provide a description of the
image for accessibility purposes. The background attribute is set to
@android:color/transparent to make the button transparent, and the
scaleType attribute is set to centerInside to ensure the entire image fits inside
the button. Finally, the padding attribute adds some extra space around the
button, and the onClick attribute specifies the method to be called when the
button is clicked.

Q2.
What is a use AlertDialog,
with Example
Ans-

An AlertDialog is a dialog window that displays a message to the user
and optionally provides buttons for the user to respond to the
message. It can be used to display various types of messages to the
user, such as alerts, warnings, errors, confirmations, and prompts.

Here's an example of how to use an AlertDialog in Android:
Java-
// Create an AlertDialog builder
AlertDialog.Builder builder = new AlertDialog.Builder(this);

// Set the title and message of the dialog
builder.setTitle("Delete item");
builder.setMessage("Are you sure you want to delete this item?");

// Add buttons to the dialog
builder.setPositiveButton("Yes", new
DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// User clicked the Yes button, perform delete action
deleteItem();

Geschreven voor

Instelling
Vak

Documentinformatie

Geüpload op
8 maart 2023
Aantal pagina's
7
Geschreven in
2022/2023
Type
SAMENVATTING

Onderwerpen

$8.29
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper
Seller avatar
devmondal

Maak kennis met de verkoper

Seller avatar
devmondal Parul University
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
-
Lid sinds
3 jaar
Aantal volgers
0
Documenten
15
Laatst verkocht
-

0.0

0 beoordelingen

5
0
4
0
3
0
2
0
1
0

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen