-1

Recently I got this error:

android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=    launchParam=MultiScreenLaunchParams { mDisplayId=0 mBaseDisplayId=0 mFlags=0 } }

Why is this happening? I did everything like in the YT tutorial. The goal of my code is to make a link to another site. Here is my code:

 adres2 =" https://www.facebook.com/  ";

     c2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(adres2));
                startActivity(intent);

            }
        });

2 Answers2

4

Why is this happening?

You have an invalid Uri. Replace:

adres2 =" https://www.facebook.com/  ";

with:

adres2 ="https://www.facebook.com/";
CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
0

Kindly change the code and Test the following code:

       llShare.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
             Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
                shareIntent.setType("text/plain");
// Add data to the intent, the receiving app will decide what to do with it.
                shareIntent.putExtra(Intent.EXTRA_SUBJECT, "Welcome to Facebook!");
            shareIntent.putExtra(Intent.EXTRA_TEXT,"SOME DATA IN STRING FORM");

                startActivity(Intent.createChooser(shareIntent, "Share link!"));
            }
        });