Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • Check for target activity available or not

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 243
    Comment on it

    We know that implicit intents are used to perform an action that your application can't but others can do.

    Like to send some sms we uses this intent :

    Intent intent = new Intent();
    intent.putExtra(Intent.EXTRA_TEXT, textMessage);

    But do you know this can crash your app if your device doesn't have target activity to send sms.

    To solve this we use resolveActivity method like this :

      if (intent.resolveActivity(getPackageManager()) != null) {
     } else{
       //Activity not found

 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: