« first day  last day (14 days later) » 

5:04 AM
@Thanks,I am looking on the code and link which you have sent...i will update you
 
 
1 hour later…
6:30 AM
hey again i have work with this but the proper way how to do this is not yet clear can you please explain it in simple format.
 
6:45 AM
oos = new AppendingObjectOutputStream(fos);
I have confussion in this AppendingObjectSteam(fos)
 
7:10 AM
No enclosing instance of type CacheThis is accessible. Must qualify the allocation with an enclosing instance of type CacheThis (e.g. x.new A() where x is an instance of CacheThis).
 
8:08 AM
Oh wait, sorry. Can you copy the AppendingObjectOutputStream class to a new file?
public AppendingObjectOutputStream(OutputStream out) {
super(out);
}

@Override
protected void writeStreamHeader() throws IOException {
// do not write a header, but reset:
// this line added after another question
// showed a problem with the original
reset();
}

}
 
 
1 hour later…
9:13 AM
hey I have applied above code but my is crashing in offline mode...
 
Can you copy the log?
 
this is the error:E/AndroidRuntime(16905): FATAL EXCEPTION: main 10-03 14:46:50.510: E/AndroidRuntime(17137): java.lang.RuntimeException: Unable to start activity ComponentInfo{info.androidhive.customlistviewvolley/yourstory.MainActivitySlider‌​}: java.lang.ClassCastException: android.widget.ListView cannot be cast to java.util.List
 
That error wasn't showing before? Because it doesn't seem related to the caching, but of course I could be wrong.
 
9:40 AM
Can you tell which line in your code is causing the crash?
 
please wait i'm telling you
List<Object> templist = (List<Object>) CacheThis.readObject(getActivity(), fileName);
for (Object object:templist){
((List<Movie>) listView).addAll((List<Movie>) object);
This is code is given by you in morning for read local file
 
10:09 AM
hey this error i had solved
thanks
 
Any time :) good luck
 
but it look you didn't understand my previous question
when i solved this error
and testing it now
it is creating copy of articles
 
I don't understand?
 
let me give a example for brief understanding
suppose now
i loaded 50 articles in
my local file in internet mode is on.
now if i again open my app in internet mode
my app in defeated load 10 article when any user open it
now what happen is that in local file there is 50 + 10
means 60 articles
coming in when i use my app in offline mode
now you get ??
 
So do you want it to load only 10?
 
10:24 AM
now i want it should load 50
 
Okay, so never more than 50?
 
if user loaded more
then
suppose if user load 100 articles
the 100 article should be loaded in my local file
and when ever there is new article loaded in my app in internet mode that must be loaded in local file
 
Okay? And what's happening now? Is it not doing that?
 
it doing
but it make
copy of old data that is been loaded
so there are copy of data displayed to my list-view
when app run offline
 
Oh so like the same data is displayed twice?
 
10:31 AM
perfectly i need is that when new article or data is loaded in online mode that time local file data should be replayed or add a particular new data
yes becuase it is every time coping data in local file
*because
 
Okay, well you will have to find a way to know how much you have already loaded so that it doesn't save duplicate data. Or maybe load all data and check for duplicates before caching. In the project I did I didn't append new data to the file, instead i made it overwrite all the time. I'll send you an example project in a bit.
 

« first day  last day (14 days later) »