I am writing an Android App for a charity, and would like to be able to display the charity's facebook feed within the App. I don't want it to go through the phone's web browser, nor the facebook app.
I read on the developers.facebook.com how to add facebook's android sdk to the app's build gradle. But what I can't find is code for a simple android activity that will display the facebook timeline. I don't have time to dive deep into facebook's sdk to fiigure it out. And the last thing I want to do is reinvent the wheel.
Can anyone point me towards some code for a simple activity to display a facebook timeline? Any help will be greatly appreciated.
I'm not home so I can't test this right now but it should work.
In your layout file, put a webview like so:
<WebView
android:id="#+id/mWebView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
Then in the onCreate method:
WebView mWebView = (WebView) findViewById(R.id.mWebView);
WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
mWebView.loadUrl("http://LinkToFacebookPage.com/");
And finally, in your manifest file put the following permission before < Application >
<uses-permission android:name="android.permission.INTERNET" />
Related
I am developing an Android application which uses WebView, and I would like to open a link in the app. The problem I have come across is that each of our customers use a different URL and is set via a preference in the android application. From, what I understand you have to set a link in the android manifest. Is this still achievable to have a link open in the application?
In order to open a link in the app just make sure to have an Activity that has a WebView on its layout. Then, in your activity do something like this:
WebView webview = (WebView) findViewById(R.id.your_web_view);
webview.loadUrl("http://your.url/");
Just read the user preference that stores the URL before calling loadUrl() and you're all set
You need to add a webview and give it an id. And then do this in your code:
//Identify the webview
WebView web_view = (WebView)findViewById(R.id.web_view);
//start web client
web_view.setWebViewClient(new WebViewClient());
//Load URL
web_view.loadUrl("your url");
And don't forget to add this line in your AndroidManifest.xml file :
<uses-permission android:name="android.permission.INTERNET" />
Hope it works!! :)
I need to load url in webView - http://intor.club/files/comments.php?serial=56
I can not see in the webView that I see in the browser. Mobile browser works.
JavaScript is on. Help me! Thank you!
mWebView = (WebView) rootView.findViewById(R.id.webView);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.loadUrl("http://intor.club/files/comments.php?serial=56");
First make sure you xml file you showing your webview like that
width fill parent and height also
<?xml version="1.0" encoding="utf-8"?>
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/webView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
don't forget your internet permission in AndroidManifest.xml
<uses-permission android:name="android.permission.INTERNET" />
it should work know
i test it myself
when i comment javascript enable i got this
//wbeview.getSettings().setJavaScriptEnabled(true);
when i enable java Script i get this (there are no comment in this thread)
i see you want access comment , may be you not authorized to access it.
Things you should try :-
1- try connect your facebook or any other connection to this site and access this link again .
2- try connect to main Page it will work "http://intor.club/ "
I have a doubt. What happens is the following:
I exported my game by using cocoonjs contruct 2, but I want to run it on my android webview by, because I want to implement starApp, and cocoonjs not support this.
So, using my code below, I get only a blank screen.
But in my launcher cocoonjs, this same project works normally, just that I select Canvas + can anyone help me?
web = (WebView) findViewById(R.id.webInicial);
web.setWebChromeClient(new WebChromeClient());
web.getSettings().setJavaScriptEnabled(true);
web.loadUrl("file:///android_asset/www/index.html");
webView.loadData(yourData, "text/html", "UTF-8");
Where youData is the actual HTML data.
Have you tried getApplicationContext().getAssets().open("www/index.html");?
If that doesn't work, I'd say try the solutions in this post and let us know if it worked for you.
In my application on click of a button i am trying to launch the following url using a web view :
https://maps.google.com/maps?saddr=indiranagar bangalore&daddr=mgroad bangalore
My code is as below:
WebView webView=new WebView(this);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setBuiltInZoomControls(true);
webView.getSettings().setSupportZoom(true);
webView.loadUrl("https://maps.google.com/maps?saddr=indiranagar bangalore&daddr=mgroad bangalore");
When the web view appears it first displays the following:
And immediately displays the following:
I do not get to see the maps. Am i missing on something in my code. Can someone kindly help me with this please. Thanks in advance.
I had the same issue in using Google Maps URL into a ColorBox popup.
I found out that you can add &output=embed at the end of the URL to make it show in an iframe.
Maybe this solution will help you too.
So try:
webView.loadUrl("https://maps.google.com/maps?saddr=indiranagar bangalore&daddr=mgroad bangalore&output=embed");
i found that WebView does not support javascript by default, and this will lead google map jump to a URL that contains a params "nojs",
so, just add this line for your webview, problem gone.
webview.getSettings().setJavaScriptEnabled(true);
I am trying to show
http://www.google.co.jp/m/place#ipd:mode=home
website thru WebView in Android emulator but I am not seeing the web
site and seeing only blank space under the place tag of the page.
I am able to see other sites like www.google.com.
Do I need to enable more settings for the google place page?
Permission in the manifest
<uses-permission android:name="android.permission.INTERNET" />
Code
WebView view= (WebView) findViewById(R.id.view1);
View.getSettings().setJavaScriptEnabled(true);
View.getSettings().setBuiltInZoomControls(true);
View.getSettings().setSupportZoom(true);
View.loadUrl(" http://www.google.co.jp/m/place#ipd:mode=home");
You need to do
view.getSettings().setAppCacheEnabled(true);
view.getSettings().setDomStorageEnabled(true);
on the setting object. That fixed the problem for me.