Android webview twitter link not opening - android

The link below is not opening in android webview .I am new to android. Someone help me to open this link in webview.
https://mobile.twitter.com/SCHOOLinSITES
I tried to open it in the following manner
XML
<WebView android:id="#+id/webView51"
android:layout_width="match_parent"
android:layout_height="match_parent">
</WebView>
Activity
WebView w=(WebView)findViewById(R.id.webView51);
w.getSettings().setDomStorageEnabled(true);
w.getSettings().setJavaScriptEnabled(true);
w.loadUrl("https://mobile.twitter.com/SCHOOLinSITES");

Set a userAgent in your Webview.
webView.getSettings().setUserAgentString("Android");
webView.loadUrl("https://mobile.twitter.com/SCHOOLinSITES");

Related

Android webview can not load web pages

I can not load web pages using webview,Nothing is displayed,
this url "http://dev.51yunche.com:7000/WeChat/Service%20introduce.html",
this is my webview
webView = (WebView) findViewById(R.id.drive_web);
webView.setWebViewClient(new WebViewClient());
webview.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setAppCacheEnabled(true);
webView.getSettings().setDomStorageEnabled(true);//DOM Storage
webView.loadUrl("http://dev.51yunche.com:7000/WeChat/Service%20introduce.html");
this xml:
<WebView
android:id="#+id/drive_web"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
The console does not have any prompts or error messages。I'd like to hear some input from more experienced WebView users (and developers?).
Thank you in advance!
This is not webview Issue.In web browser also that url display Nothing.check that Backend or design code of your html file.
You have a space encoded character %20 in your URL...
use a valid url like:
webView.loadUrl("http://dev.51yunche.com:7000/WeChat/Serviceintroduce.html");
Alternatively you can also try URLEncoder.encode(YOUR_URL); function to encode the Url
Your link itself doesn't display anything in web browser. If you still have any doubt, just simply create a normal html page by yourself and run it from your local system and check it out.

Simple Android activity for displaying Facebook timeline?

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" />

Create an app from responsive site that uses ajax calls that return both html and javascript - easiest way?

I'm looking for the easiest and most efficient way to create a mobile app from my website that is already fully responsive.
I have a page that contains 5 different ajax calls. Each ajax call returns both html and javascript which is created by a PHP script. All JavaScript that is is not user dependent is in a separate file. There is also a separate file for all css.
I think converting the code (using phonegap) will be very difficult because of the ajax calls. Preferably I would like to have an app that installs an icon on someone's phone and that just opens my website in a browser (without showing anything of that browser).
My question: What is the easiest way to create an app for android and ios?
Webview? If you are looking to build an app that just opens your webpage and does not show that its opened AOSP browser or any other browser for that matter then just use webview. It would open like any other activity in your app but the content (depending on how big you want the webview) will just be your site. I did a very similar thing in my android app and here is the code.
Java Class:
public class website extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_website);
String url = "http://www.YourWebsiteHere.co.uk";
WebView view = (WebView) this.findViewById(R.id.webViewSite);
view.getSettings().setJavaScriptEnabled(true);
view.loadUrl(url);
}
XML File:
<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/webViewSite"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" /> </RelativeLayout>
http://developer.android.com/reference/android/webkit/WebView.html

webview does not show all content

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/ "

simplest way to load android webview

what is the simplest way to load android webview?
I have already specified webview in the activity layout, how can i load a website on it while running the emulator. I have had many problems with resources not identified and the main_activity.out.xml files have been giving me troubles. A simple webview to load a webpage would be nice.
...
<WebView
android:id="#+id/webView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" />
You are getting main_activity.out.xml because you are trying to compile Xml files (main_activity.out.xml have the focus and you clicked run). In general if this error happens you have to
Delete the xxx.out.xml
Open any .java file in src/ by double click in the file so it has focus and the cursor is in there
Run your project and everything should be OK now
to load WebView you have to declare your webview component in your xml
<WebView
android:id="#+id/myWebView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
and then in your activity in onCreate() method call
// get reference to your view
WebView webview = (WebView)findViewById(R.id.myWebView);
// load your WebView content
webview.loadUrl("http://google.com/");
Simplest way?
Get access to WebView via
WebView webview = (WebView)findViewById(R.id.webView1);
webview.loadUrl("http://stackoverflow.com/");
Greets
Flo
main_activity.out.xml has been created maybe beacuse you pressed the run button on Eclipse while your main_activity.xml was opened. Eclipse tryed to compile your xml and not your application.
To do that right, try to select the reference of your application inside the project explorer on the left and then click the Run button.
In order to manage at best the webview in your android project, just read the documentation:
http://developer.android.com/guide/webapps/webview.html

Categories

Resources