【问题标题】:how to integrate facebook page on android application?如何在 android 应用程序上集成 facebook 页面?
【发布时间】:2015-06-16 02:28:13
【问题描述】:

我不知道如何在 android 应用程序上添加指向 facebook 页面的链接。 我已经有一个图像按钮,我希望它可以点击并将用户发送到我们的 Facebook 页面。 谢谢

【问题讨论】:

  • 当您单击按钮时,打开浏览器并显示 facebook 页面。

标签: android facebook twitter hyperlink icons


【解决方案1】:

在你的布局中使用 WebView 并尝试一下

public void onClick(View v){
      String url = "www.facebook.com";
        mWebView.setWebViewClient(new WebViewClient(){

            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                view.loadUrl(url);
                return true;
            }
        });
    }

【讨论】:

    【解决方案2】:

    试试这样:

    @Override
    public void onCreate(Bundle savedInstanceState) {
    	super.onCreate(savedInstanceState);
    	setContentView(R.layout.main);
    
    	addListenerOnButton();
    
    }
    
    public void addListenerOnButton() {
    
    	imageButton = (ImageButton) findViewById(R.id.imageButton1);
    
    	imageButton.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View arg0) {
          
             Intent browserIntent = new Intent(Intent.ACTION_VIEW,Uri.parse("http://www.facebook.com"));
             startActivity(browserIntent);
    
    		}
    
    	});
    
    }
     
    }

    在 XML 布局中添加:

      <ImageButton
            android:id="@+id/imageButton1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/android_button" />

    【讨论】:

      猜你喜欢
      • 2011-12-10
      • 1970-01-01
      • 1970-01-01
      • 2011-06-03
      • 2012-04-13
      • 1970-01-01
      • 2015-04-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多