I'm writing an android magazine reader for a campus publication I work for. We use wordpress to publish our website, and I want to leverage the wordpress REST API to pull stories (posts) directly from the website, without publishers having to take any additional steps to publish posts on the app after publishing them on the site. I'll do this by getting JSON objects representing posts and deserializing them into POJOs of the Story class (defined in the android application), around which views will then be built dynamically.
I've just discovered the Wordpress REST API and am really excited because I think that the implementation as described above is going to be pretty simple. Are there any obvious roadblocks that I'm missing that might complicate things?
I know that the API responds with a "content" parameter that is a string containing the HTML code for the post, with references to included images/media in the appropriate places. How can I get Android to load that html and display it properly in a WebViewer?
If you don't want to parse the html and separately load images and other resources, simply use
loadDataWithBaseURL like so:
WebView storyView = (WebView) findViewById( .... );
String htmlToDisplay = ....;
storyView.loadDataWithBaseURL( "http://storysite.com/', htmlToDisplay, mimeType, encoding, "" );
The baseURL will be prepended to all relative partial URIs found in the document, so that the WebView can take care of loading all other assets for you.
Related
I am trying to build my new App and I need some data for it.
so I was wondering if I can get JSON data (or query link or any source file) of any site for now and for future.
I need to get data from this site:
https://study.ekb.eg/ - https://www.ekb.eg/
Note: https://www.ekb.eg/ is the main source data for https://study.ekb.eg/
Thanks
The site needs to be specifically programmed to return JSON data for you. Regular, normal sites are not like this. They generally just return HTML
So the site owner would need to set up an API for you to consume
Eurostat data can be downloaded via a REST API. The response format of the API is a XML file formatted according to the SDMX-ML standard. With SAS, very conveniently, one can access XML files with the libname statement and the XML or XMLv2 engine.
Currently, I am using the xmlv2 engine together with the automap= option to generate an xmlmap to access the data. It works. But the resulting SAS data sets are very unstructured, and for another data set to be downloaded the data structure might change. Also the request might depend on the DSD-file that Eurostat provides for each database item within a different XML file.
Here comes the code:
%let path = /your/working/directory/;
filename map "&path.map.txt";
filename resp "&path.resp.txt";
proc http
URL="http://ec.europa.eu/eurostat/SDMX/diss-web/rest/data/cdh_e_fos/..PC.FOS1.BE/?startperiod=2005&endPeriod=2011"
METHOD="GET"
OUT=resp;
run;quit;
libname resp XMLv2 automap=REPLACE xmlmap=map;
proc datasets;
copy out=WORK in=resp;
run;quit;
With the code above, you can view all downloaded data in your WORK library. Its a mess.
To download another time series change parameters of the URL according to Eurostat's description.
So here is my question
Is there a way to easily generate a xmlmap from a call to the DSD file so that the data are stored in a well structured way?
As the SDMX-ML standard is widely used in public institutions such as the ECB, Eurostat, OECD... I am wondering if somebody has implemented requests to the databases, already. I know about the tool from Banca Italia which uses a javaObject. However, I was wondering if there might be a solution without the javaObject.
I would like to retrieve the download link for large video files. I have no problems with small video files but with large videos, the response from the server is that the file
"exceeds the maximum file size that Google can scan"
I want to use the link as the source to a video tag. But because that link gives me the error, I can't use it.
I'm using the Java SDK and I'm using File.getWebContentLink() to get the link. I've tried getDownloadLink() but that one doesn't even work.
Basically, is there anyway I can get the download link for large video files?
getWebContentLink() is designed for interactive users (browsers).
Instead, at the raw API level you'll want to use File.get with alt=Media AND also set the acknowledgeAbuse flag if you initially get returned the 'Google can't scan'. Read more on downloading files here and the abuse flag here.
In the Java client library, it'd look something like this:
String fileId = "0BwwA4oUTeiV1UVNwOHItT0xfa2M";
OutputStream outputStream = new ByteArrayOutputStream();
driveService.files().get(fileId)
.set("acknowledgeAbuse", true)
.executeMediaAndDownloadTo(outputStream);
Disclaimer, I haven't compiled the above.
Note: Do not use the .../host/id method mentioned in the other answer - that method is deprecated and scheduled to stop serving content by end of August, 2016 (this year)
Try using https://googledrive.com/host/id where id is the file's ID. Inspired by http://www.scriptscoop2.com/t/1eb5579419c6/issue-when-trying-to-stream-a-video-from-google-drive-inside-html5-vid.html.
I m new in Android development and never been in JAVA before.
With online tutorials and stackoverflow help I managed to generate a list with XML,
Now I m making it work like if I clicked on list item, it will open other activity.
With php I managed to generate xml I want on request but now in android I want that single entry XML
<item name="something"><description>Item description</description></item>
like this. But I'm not sure how can I read this remote xml and store values as a string
String name = Name attribite value & same for description.
You should use a parser like as Pullparser, Saxparser or something what you need.
You can follow the following: Parsing example
Make one SOAP Web service and call it from Android application. Please find tutorial here
Regarding SOAP:- http://suda.co.uk/publications/MSc/brian.suda.thesis.pdf
And regarding how to use with Android:- http://androidtestexample.blogspot.in/2012/02/soap.html
I hava a Java/Grails app that needs to "read" the contents of a given URL to use it as an image, mostly to be dinamically resized.
My app already parses the url into HTML code using an implementation based on this post: http://www.roseindia.net/java/example/java/io/SourceViewer.shtml.
The class I built returns a String object that contains the HTML source code. Now I want to write this String into an object similar to a BufferedImage so I can display the captured URL into my new application.
any ideas, thanks in advance!
You can use a service like Bluga.net WebThumb and use Glen Smith's ThumbnailService to interface with it.
Or, if you really want to do this by yourself, you can use his Thumbnail Server (with an older version of the ThumbnailService), that he used to use before migrating to WebThumb ;)
Regards
You can create an Image object from a url :
URL url = new URL("http://url.to/your/image.jpg";
Image image = Toolkit.getDefaultToolkit().createImage(url)
If by
take a 'print screen' of the this site
you mean display in your app take a look at this : http://www.java-tips.org/java-se-tips/javax.swing/how-to-display-pages-for-a-web-site-in-your-applic.html