Hello Every One ,
I am working on the WebView and i want to save the webView object and
then read it , Now i able to save webview object successfully but my
ObjectinputStream cannot able to read the object.
Here is my source code :
public class myCustomWebView extends WebView implements Serializable{
static final long serialVersionUID = 7523967970034938905L;
public myCustomWebView (Context c){
super(c);
}
}
public boolean saveObject(String fileName,Object data_TO_BE_SAVED)
{
boolean result = false;
File myFile=null;
myFile = getFileStreamPath("X").getParentFile();
System.out.println("PATH WE GOT IS ... " + myFile.getPath());
myFile = new File(myFile,fileName);
System.out.println("AFTER CONSTRUCTOR WE GOT IS ... " +
myFile.getPath());
try{
FileOutputStream fos = openFileOutput(fileName,
Context.MODE_WORLD_READABLE);
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(data_TO_BE_SAVED);
fos.flush();
fos.close();
System.out.println("Object Saved.....");
result = true;
}catch(Exception ex){
ex.printStackTrace();
}
return result;
}
public void getSavedObject(String fileName){
System.out.println("fileName is " + fileName);
try{
FileInputStream fis = this.openFileInput(fileName);
ObjectInputStream ois = new ObjectInputStream(fis);
Object obj = (Object) ois.readObject();
System.out.println("WebView Object is \n\n" + obj);
ois.close();
fis.close();
}catch(Exception ex){
ex.printStackTrace();
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---