Nidhi
Nidhi

Reputation: 699

how to perform two actions on a single click?

How can I write command in onclicklistener() so that I can move to next activity as well as my post status dialog will appear on that new activity. I am using intent for switching to next activity and also using postTowall() method. But these two doesn't perform simultaneously. I am using this method:

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

    postTowall();
    Intent intent= new Intent(Frnd.this,Logout.class);
    startActivity(intent);

    }

    private void postTowall() {
        facebook.dialog(this, "feed", new DialogListener() {

      @Override
      public void onFacebookError(FacebookError e) {
      }

      @Override
      public void onError(DialogError e) {
      }

      public void onComplete(Bundle values) {
          String sh = null;
          Bundle params = new Bundle();

          params.putString("caption", sh);
      }

      public void onCancel() {
          // TODO Auto-generated method stub
      }

Upvotes: 0

Views: 106

Answers (2)

Sushil
Sushil

Reputation: 8478

You can use thread for posting. Use asynctask and inside that post the message to face book. Or you may just write a simple thread and start it.

This asynctask link may help you. it has usage example also:

http://developer.android.com/reference/android/os/AsyncTask.html

Upvotes: 1

Nemanja Kovacevic
Nemanja Kovacevic

Reputation: 3560

You should set other activity to open post dialog. Send via intent a signal if it should or not...

Upvotes: 0

Related Questions