0% found this document useful (0 votes)
14 views

Android Application Answers-3

The document discusses different user interface views in Android, data storage options like SQLite and content providers, sending emails, location based services, and types of intents and Android devices. It provides code samples for querying the contacts content provider and sending emails. It asks questions about geocoding, intents, SQLite features.

Uploaded by

Nikita Raj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Android Application Answers-3

The document discusses different user interface views in Android, data storage options like SQLite and content providers, sending emails, location based services, and types of intents and Android devices. It provides code samples for querying the contacts content provider and sending emails. It asks questions about geocoding, intents, SQLite features.

Uploaded by

Nikita Raj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 19

Discuss different types of user interface view

Ans:
What are the purpose of geocoding?
What are the two types of intent?

What are the different data storage options available on the Android platform
Explain content provider in android
// Querying contacts Content Provider
Uri uri = ContactsContract.Contacts.CONTENT_URI;
String[] projection = {ContactsContract.Contacts._ID,
ContactsContract.Contacts.DISPLAY_NAME};

Cursor cursor = getContentResolver().query(uri, projection, null, null,


null);

if (cursor != null) {
while (cursor.moveToNext()) {
String contactId =
cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts._ID
));
String displayName =
cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.DIS
PLAY_NAME));

// Process contact data


}
cursor.close();
}
Q: What are the features of SQLite?
Explain how to send email in android application

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;

public class EmailActivity extends AppCompatActivity {


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_email);

findViewById(R.id.sendEmailButton).setOnClickListener(new
View.OnClickListener() {
@Override
public void onClick(View view) {
sendEmail();
}
});
}

private void sendEmail() {


Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.setType("text/plain");
emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[]
{"[email protected]"});
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Subject of
the Email");
emailIntent.putExtra(Intent.EXTRA_TEXT, "Body of the
Email");

// Optional: Specify the package name of the email client


(e.g., Gmail)
// emailIntent.setPackage("com.google.android.gm");

startActivity(Intent.createChooser(emailIntent, "Choose an
Email client:"));
}
}

Replace "[email protected]", "Subject of the Email", and "Body of the


Email" with the actual recipient email address, subject, and body content. The sendEmail
method is called when the associated button is clicked.
Explain location based services
explain types of intent in android
what are the different types of android devices in
market

You might also like