So far in Android I know how to wall post to the user's wall via the web but I'd like, the app to detect whether the user has the facebook application installed and if so post via that. Does anyone know how to do this?


My code so far is below:

Java Code:
    public class MainActivity extends Activity 
    {
    	private static String FACEBOOK_APP_ID = "276023232498070";
    	private static final String[] PERMISSIONS = new String[] { "publish_stream","email","user_birthday","user_location" };
    	private Facebook facebook; 
    
    	   @Override
    	   public void onCreate(Bundle savedInstanceState) 
    	   {
    	      super.onCreate(savedInstanceState);
    	      setContentView(R.layout.activity_main);
    	      facebook = new Facebook(FACEBOOK_APP_ID);
    	      Bundle parameters = new Bundle();
    	        parameters.putString("app_id", "276023232498070");
    	        parameters.putString("link", "https://play.google.com/store/apps/details?id=myappistasty");
    	        parameters.putString("name", "This is the name of the link set in app.");
    	        parameters.putString("caption", "This is Text that is specified in bt the aoo");
    	        parameters.putString("picture", "http://i.dailymail.co.uk/i/pix/2012/11/15/article-0-1609D0FF000005DC-373_964x641.jpg");
    
    	      // Posting my message, maybe here i could add paramterers like icon and a link etc..?
    	      facebook.dialog(MainActivity.this, "feed", parameters,new PostDialogListener());
    	   }
    
    	   @Override
    	   public void onActivityResult(int requestCode, int resultCode, Intent data) 
    	   {
    
    	    super.onActivityResult(requestCode, resultCode, data);
    	    facebook.authorizeCallback(requestCode, resultCode, data);
    	    Toast.makeText(getApplicationContext(), "Hello", Toast.LENGTH_LONG).show();
    
    	   }
    
    	 public abstract class BaseDialogListener implements DialogListener {
    	        @Override
    	        public void onFacebookError(FacebookError e) {
    
    
    	    e.printStackTrace();
    	}
    	@Override
    	public void onError(DialogError e) {
    	        e.printStackTrace();
    	    }
    	    @Override
    	    public void onCancel() {
    	    }
    
    
    	  }
    
    	    public class PostDialogListener extends BaseDialogListener {
    	        @Override
    	        public void onComplete(Bundle values) {
    	            final String postId = values.getString("post_id");
    	            if (postId != null) {
    	               Log.e("","Message posted on the wall.");
    	               MainActivity.this.finish();
    	            } else {
    	                Log.e("","No message posted on the wall.");
    	                MainActivity.this.finish();
    	            }
    	            }
    	        }
    	      }