Share website url on whats app using android studio
<p>I have tried following for sharing website url on whatsapp. I got error of please try again. I refers the code from  <a href="http://techzog.com/development/android-share-to-whatsapp-code-for-developers/" rel="nofollow">http://techzog.com/development/android-share-to-whatsapp-code-for-developers/</a> Dose anyone know how do i do that? </p>

<pre><code> public class MainActivity extends Activity {

    EditText message;
     Button btn;
    ImageView img;
    Uri uri;
    String imgurl="http://www.google.com";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
      uri = Uri.parse(""+imgurl);
        //Caption for the image!
        message = (EditText) findViewById(R.id.caption);
        btn=(Button)findViewById(R.id.button1);
        img=(ImageView)findViewById(R.id.imageToBeShared);
        btn.setOnClickListener(new View.OnClickListener() {
                                   @Override
                                   public void onClick(View v) {
                                       PackageManager pm = getPackageManager();
                                       try {

                                           Intent waIntent = new Intent(Intent.ACTION_SEND);
                                           waIntent.setType("text/plain");
                                           String text = "Want to share this";

                                           PackageInfo info = pm.getPackageInfo("com.whatsapp", PackageManager.GET_META_DATA);
                                           //Check if package exists or not. If not then code
                                           //in catch block will be called
                                           waIntent.setPackage("com.whatsapp");
                                           waIntent.putExtra(waIntent.ACTION_VIEW, uri);
                                           waIntent.putExtra(Intent.EXTRA_TEXT, text);
                                           startActivity(Intent.createChooser(waIntent, "Share with"));

                                       } catch (PackageManager.NameNotFoundException e) {
                                           Toast.makeText(MainActivity.this, "WhatsApp not Installed", Toast.LENGTH_LONG)
                                                   .show();
                                       }

                                   }
                               }
        );
    }
}
</code></pre>