Recently i am making an app on facebook. So i have use facebook api. From api we got data from json parsing. Now in my app i am showing all update of user and his friends in table view. But problem is that when i get data from json parsing then application take so much time due to loading image in app. So i want that i show first text message and when view did load then upload images so that time will reduce. How do that i have no idea? So tell how i fix it?
I have use synchronous method to parse data from json. What approach i will use so i can consume less time?
I have sort my problem by seeing sample provided by Apple docs named as lazy table. In that i have edit like as in lazy table image upload on scroll to table so i remove that function. Now in my table when table load then image also load at that instant.Apple
Related
I am new to flutter and I found load csv from local and display as listview but I want to load from url and display. How can I do that?
A .csv from a remote source will probably have the content type of text/csv.
You should be able to call the url using a library (https://pub.dev/packages/http is a good choice, although I hear good things about Dio and probably a few others I haven't come across), get the data (e.g. as a http.Response), parse the response into some sort of model and then display it within the list view. Ideally the differences between displaying data from a local and remote source would be minimal - just where the data is coming from. This means you should be able to reuse the code you've written to load the data from a local source.
Without more information its hard to help. There's a good tutorial on building out Flutter apps using the Clean architecture at https://resocoder.com/category/tutorials/flutter/tdd-clean-architecture/. The difference will be that the Response data will be csv rather than JSON, so you'll need to sub in what you've done for the local loading.
I'm developing an app and one of its features is similar to twitter,so I have a table with each "tweet" and I display the user's picture too and I don't know what is the best way to load a lot of pictures. The images come from the server as an url.
My app's structure is:
1- I call to the server, and I get the response
2- I parse the response and I iterate it creating objects
3- I load that objects in the tableview's store
4- I reload the table
I thought one way is when I am creating the object, I load the image and I assign to the object's attribute. I mean, each time I create a object type "tweet" for example, I create the image calling the url with nsdata...
I dont know if that solution is correct or can be better. Can anyone give me a hand? Thanks in advance
Take a look at the SDWebImage API. It will do much of this automatically for you.
I'm in the process of developing an iOS app that retrieves images from a URL (http://m.9gag.com). It so happens that the HTML for the URL is in constant change and whenever I have a working code, the site's style changes.
Is there any way I could pull those images from the HTML without having to worry about webpage changes? There is no public API at the moment so that's sadly not an option.
I look forward to hearing some options.
Also, if the page is set so that when the user scrolls to the bottom, it loads more content, how can I get more html to load based on how far down in the HTML parsing I've got? I'm not using a webview, I just need to update the HTML I initially retrieved.
It seems that the simplest way in your case - use regular expression (for example http://[A-Za-z0-9_/\.]*\.jpg) to extract URLs and keep track of already pulled images.
Let's say I have XML data that I just downloaded from a web app api.
How do I parse the data?
How do I populate each cell of a table view with this data?
Here is a tutorial that does exactly what you are asking for. It downloads an RSS feed (which is XML), parses it, then loads the data into a table.
It should be easy to modify this for your application.
http://theappleblog.com/2008/08/04/tutorial-build-a-simple-rss-reader-for-iphone/
try using NSXMLParser. You can get the documentationhere
So I've transferred the core data code from Apple's sample Core Data / RSS parser application, TopSongs, into my own application. It loads fine, (i.e. no errors or warnings) and the first time you open the app all that happens is the UIActivityIndicator spins and then stops. No data displays in the UITableView.
You then have to close the app, and then re-open it (not re-build it) which then finally displays the data in the table. Why is it doing this? Is there a way to stop it happening?
Thanks.
I suspect the sample code is using a NSFetchResultsController. If that is the case then you need to make sure you have set the delegate and that the delegate responds to the methods that the NSFetchResultsController calls so that it can notify you when the data changes.
What's happening is that your app is parsing RSS data and storing whatever is parsed into Core Data storage. However, your views aren't updated when Core Data is updated. It's similar to loading a web page and then having something else change the HTML for the page without having the browser reload; that's what's happening with your UITableView.
It seems like what you need is to refresh the data source for the UITableView when the parser reaches the end of the RSS feed.