0

i am trying to link my app with my facebook page. when i tap the button, application get closed.

here is the code. what wrong i did.

Button b = (Button) findViewById(R.id.button2);
    b.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub



            try {
                context.getPackageManager().getPackageInfo("com.facebook.katana", 0);

                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("fb://page/123456789"));
                startActivity(intent);
                 } 
                   catch(Exception e)
                 {
                   startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.facebook.com/qwert")));
                                           }
            }
        });
daas12
  • 25
  • 6
  • Did you get errors in LogCat? Please post if you got.. – Ashish Tiwari Oct 30 '14 at 12:44
  • fb://page/123456789 is not working, instead if i put web address its working fine. i want the user to open Facebook app if the user has it installed Otherwise,the browser will open the Facebook. – daas12 Oct 31 '14 at 12:00
  • Okay, see this link (http://stackoverflow.com/questions/4191492/launch-facebook-app-from-other-app). It might help you. – Ashish Tiwari Oct 31 '14 at 12:26

0 Answers0