Android 在安卓系统中长按共享链接或图像

Android 在安卓系统中长按共享链接或图像,android,facebook,Android,Facebook,我想在长按该链接时在facebook上共享该链接。我想点击按钮进入facebook或其他网站,但我想长按该链接。有人能帮我吗 public class MainActivity extends Activity { Button btn; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layou

我想在长按该链接时在facebook上共享该链接。我想点击按钮进入facebook或其他网站,但我想长按该链接。有人能帮我吗

public class MainActivity extends Activity {
Button btn;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    btn = (Button) findViewById(R.id.btn);
    btn.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            Intent sharingIntent = new Intent(
                    android.content.Intent.ACTION_SEND);
            sharingIntent.setType("text/plain");
            String shareBody = "Here is the share content body";
            sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,
                    "Subject Here");
            sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT,
                    shareBody);
            startActivity(Intent.createChooser(sharingIntent, "Share via"));

        }
    });
}

}

只需使用按钮
onLongclickListner
事件,如下所示

button.setOnLongClickListener(new OnLongClickListener() { 
        @Override
        public boolean onLongClick(View v) {
            // your code goes here
            return true;
        }
    });
仅使用长按按钮(dude:)


我想发布特定链接Pooja获取此链接可能有助于您在长时间单击listener set后使用
设置LongClickListener()
将数据传递到facebook查看有关将数据传递到facebook的讨论
   btn = (Button) findViewById(R.id.btn);
        btn.setOnLongClickListener(new setOnLongClickListener() {

            @Override
            public boolean onLongClick(View v) {

                Intent sharingIntent = new Intent(
                        android.content.Intent.ACTION_SEND);
                sharingIntent.setType("text/plain");
                String shareBody = "Here is the share content body";
                sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,
                        "Subject Here");
                sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT,
                        shareBody);
                startActivity(Intent.createChooser(sharingIntent, "Share via"));
                return true;

            }
        });