What is an Android PendingIntent?

I am a newbie to Android. I read the Android Documentation but I still need some more clarification. Can anyone tell me what exactly a PendingIntent is? 18 s 18 A PendingIntent is a token that you give to a foreign application (e.g. NotificationManager, AlarmManager, Home Screen AppWidgetManager, or other 3rd party applications), which allows … Read more

How to open the Google Play Store directly from my Android application?

I have open the Google Play store using the following code Intent i = new Intent(android.content.Intent.ACTION_VIEW); i.setData(Uri.parse(“https://play.google.com/store/apps/details?id=my packagename “)); startActivity(i);. But it shows me a Complete Action View as to select the option (browser/play store). I need to open the application in Play Store directly. 25 s 25 You can do this using the market:// … Read more

Send Email Intent

Intent intent = new Intent(Intent.ACTION_SEND); intent.setType(“text/html”); intent.putExtra(Intent.EXTRA_EMAIL, “[email protected]”); intent.putExtra(Intent.EXTRA_SUBJECT, “Subject”); intent.putExtra(Intent.EXTRA_TEXT, “I’m email body.”); startActivity(Intent.createChooser(intent, “Send Email”)); The above code opens a dialog showing following apps:- Bluetooth, Google Docs, Yahoo Mail, Gmail, Orkut, Skype etc. Actually, I want to filter these list-options. I want to show only email related apps e.g. Gmail, Yahoo Mail. How … Read more

Sending Email in Android using JavaMail API without using the default/built-in app

I am trying to create a mail sending application in Android. If I use: Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); This will launch the built-in Android application; I’m trying to send the mail on button click directly without using this application. 26 s 26 Send e-mail in Android using the JavaMail API using Gmail authentication. Steps … Read more

How to start new activity on button click

In an Android application, how do you start a new activity (GUI) when a button in another activity is clicked, and how do you pass data between these two activities? 27 s 27 Easy. Intent myIntent = new Intent(CurrentActivity.this, NextActivity.class); myIntent.putExtra(“key”, value); //Optional parameters CurrentActivity.this.startActivity(myIntent); Extras are retrieved on the other side via: @Override protected … Read more

How do I get extra data from intent on Android?

How can I send data from one activity (intent) to another? I use this code to send data: Intent i=new Intent(context,SendMessage.class); i.putExtra(“id”, user.getUserAccountId()+””); i.putExtra(“name”, user.getUserFullName()); context.startActivity(i); 16 s 16 First, get the intent which has started your activity using the getIntent() method: Intent intent = getIntent(); If your extra data is represented as strings, then … Read more

How to pass an object from one activity to another on Android

I am trying to work on sending an object of my customer class from one Activity and display it in another Activity. The code for the customer class: public class Customer { private String firstName, lastName, Address; int Age; public Customer(String fname, String lname, int age, String address) { firstName = fname; lastName = lname; … Read more