Đăng nhập

Đăng Nhập Facebook Like Đăng Nhập Hoặc Đăng Ký, Đăng Nhập Facebook

I utilize the facebook html like for my app to open a webview like this https://developers.facebook.com/docs/plugins/like-button/

The webview shows a Like and Share button, but after I login to facebook, it doesnt return to the Like and Share button, but a blank page, the share button works fine.

So how do I return to the facebook like url after logging in?

public class LikeFacebookActivity extends BaseActivity { private WebView webView; private final String URL = “facebookIDhere”;

Đang xem: Facebook like đăng nhập

Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.like_facebook_webview); webView = (WebView) findViewById(R.id.webView1); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setAppCacheEnabled(true); webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); showLoading(); webView.setWebViewClient(new MyWebViewClient()); webView.loadUrl(URL); ActionBar actionbar = getActionBar(); actionbar.setCustomView(R.layout.actionbar_top_like_facebook); actionbar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); Button backButton = (Button) findViewById(R.id.buttonGeneralBack); backButton.setOnClickListener(new OnClickListener() {
Override public void onBackPressed() { finish(); overridePendingTransition(R.anim.animation_slide_from_left, R.anim.animation_slide_to_right); } public class MyWebViewClient extends WebViewClient {
Override public boolean shouldOverrideUrlLoading(WebView view, String url) { if(url.contains(“something”)) return true; return false; } public void onPageFinished(WebView view, String url) { hideLoading(); } }}
android facebook facebook-like

*

*

I have solved this, just use system.out.println to see which page does facebook load after loggin in

public class MyWebViewClient extends WebViewClient {

Xem thêm: Cách Chuyển File Pdf Sang Jpg Bằng Foxit Reader, Chuyển Pdf Sang Jpg

Override public boolean shouldOverrideUrlLoading(WebView view, String url) { if(url.contains(“something”)) return true; return false; //Default is to not override unless our condition is met. } public void onPageFinished(WebView view, String url) { hideLoading(); //String webUrl = webView.getUrl(); //System.out.println(webUrl); if(url.startsWith(“https://www.facebook.com/plugins/close_popup.php#_=_”)){ String redirectUrl = URL; view.loadUrl(redirectUrl); return; } super.onPageFinished(view, url); }}

*

Thanks for contributing an answer to Stack Overflow!

Please be sure to answer the question. Provide details and share your research!

But avoid

Asking for help, clarification, or responding to other answers.Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.

Post Your Answer Discard

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged android facebook facebook-like or ask your own question.

*

Xem thêm: ▷ Baohiemxahoi Gov Vn Đăng Nhập, Tra Cứu Mã Số Bhxh

site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev2021.4.5.38984

Your privacy

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Show More

Related Articles

Back to top button
Close