Search code examples
androidxmlmediawikiwikipediawikipedia-api

How to retrieve parts of Wikipedia content into Android App?


Basically, I want to retrieve content from wikipedia. But I want to display it inside my Android Apps directly. Not immidiately redirect to the internet browser, but to display it inside my apps first.

Currently, I manage to request the Wikipedia API and get only the main content by using http://en.wikipedia.org/w/api.php?action=parse&prop=text&format=xml&page=Bla_Bla_Bla. and because I parse the data, I will use WebView to render in the Android. It successfully rendered. But only to those unprotected article...

If it is protected such as Mona Lisa, the output was not rendered properly in the WebView Android.

I want to know has anybody try to retrieve a wikipedia content and display it in your android apps, easily and beautifully?

Thank you :)


Solution

  • I have managed to find an answer. I think I over complicated this thing. We can actually retrieve the content perfectly without calling the mediawiki API.
    Wikipedia already provides a mobile interface.

    I just need to use a WebView to load http://en.m.wikipedia.org/wiki/ and add the topic at the end of the url.
    For example the Mona Lisa site: https://en.m.wikipedia.org/wiki/Mona_Lisa

    References: http://en.wikipedia.org/wiki/Help:Mobile_access#Official_online_version