Reputation: 387
I like the way webview makes it very easy to load a webpage, though I believe it have limitations.
What I want to do is build an app for my blog. I don't want to use webview because:
If I can achieve all of this with webview, better for me, but how?
I was thinking of fetching the feed of the blog and formatting it with xml.
Due to my naivety in Android development, I might have made some wrong assumptions, please forgive that.
Upvotes: 1
Views: 1217
Reputation: 852
Use JSON to get your blog posts from your blog.Make like a API which provides all your posts in JSON format.Then Parse the JSON in your native app, convert in to types you need, in case if you want the app to run on offline, you could create a database and store the data there.
Upvotes: 0
Reputation: 21773
You're definitely following the correct path with the XML feed, but I still don't think that's optimal.
First to answer whether it can be done with webview: Yes. But I really would discourage that, using non-native applications is messy and if the user really wanted that, they could use their browser.
If you still choose to follow that path you can look at WebViewClient, that would allow you to intercept requests and change css etc. but it's a hack.
To do it with native components like RecyclerView will be much smoother. I would reccomend providing a way to get a JSON feed from your website rather than XML as it uses less data and is much easier to parse with something like GSON and then pass it to your adapter. If you make yourself a JSON option and comment on this answer I can hep you with GSON if it's also new to you. Alternatively, continue with XML and start reading about parsing xml on android
Upvotes: 3