serializable

How to pass ArrayList<CustomeObject> from one activity to another? [duplicate]

青春壹個敷衍的年華 提交于 2019-12-16 21:02:45
问题 This question already has answers here : Passing arraylist of objects between activities (5 answers) Closed 5 years ago . I want to send Following ArrayList from one activity to another please help. ContactBean m_objUserDetails = new ContactBean(); ArrayList<ContactBean> ContactLis = new ArrayList<ContactBean>(); I am sending the above arraylist after adding data in it as follows Intent i = new Intent(this,DisplayContact.class); i.putExtra("Contact_list", ContactLis); startActivity(i); But I

Android: intent.getExtras().getSerializable(Constants.codiceMainActivity) is null

北慕城南 提交于 2019-12-13 20:12:33
问题 I want to start a service from my main activity and pass an object with Serializable. However when I get the object in the Service and I call a method, it is null and I don't know why. Here is my MainActivity class: public class MainActivity extends AppCompatActivity implements View.OnClickListener, Serializable { private transient SetVocabulary setVocabulary; private transient Intent intent; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

entity framework 6 and pessimistic concurrency

坚强是说给别人听的谎言 提交于 2019-12-13 17:22:56
问题 I'm working on a project to gradually phase out a legacy application. In the proces, as a temporary solution we integrate with the legacy application using the database. The legacy application uses transactions with serializable isolation level. Because of database integration with a legacy application, i am for the moment best off using the same pessimistic concurrency model and serializable isolation level. These serialised transactions should not only be wrapped around the SaveChanges

Serialize Object that contains a Drawable Android Java

回眸只為那壹抹淺笑 提交于 2019-12-13 02:58:08
问题 I am trying to save an ArrayList<Plant> ( myPlantList ) to a file with this method. public static void savePlants(Context c){ try { FileOutputStream fOS = c.openFileOutput("plantArrList", c.MODE_PRIVATE); ObjectOutputStream oOS = new ObjectOutputStream(fOS); oOS.writeObject(myPlantList); oOS.close(); fOS.close(); } catch (IOException io) { io.printStackTrace(); } } I get an error (that does not crash the application) java.io.NotSerializableException: android.graphics.drawable.BitmapDrawable .

Serializable parcelable issue: RuntimeException: Parcelable encountered IOException writing serializable object

我与影子孤独终老i 提交于 2019-12-12 23:54:03
问题 Folks, I have simplest class which I want to be Parcelable. I'm doing it in following way: public class MyField implements Serializable, Parcelable { public MyField() { } //************************************************ // Parcelable methods //************************************************ public int describeContents() {return 0; }; public void writeToParcel(Parcel out, int flags) { out.writeInt(this.describeContents()); out.writeSerializable(this); } @SuppressWarnings("redundant") public

Field is member of a type which is serializable but is of type which is not serializable

守給你的承諾、 提交于 2019-12-12 19:09:18
问题 I'm developing a C# library with .NET Framework 4.7. I want to convert the class ProductionOrderXmlFile into a XML file: [Serializable] public class Level { [XmlElement("Id")] public byte Id { get; set; } [XmlElement("Name")] public string Name { get; set; } [XmlElement("CodeType")] public byte CodeType { get; set; } [XmlElement("CodeSourceType")] public byte CodeSourceType { get; set; } [XmlElement("HelperCodeType")] public byte HelperCodeType { get; set; } [XmlElement("HelperCodeSourceType"

How to load a serialized file back to an arrayList

这一生的挚爱 提交于 2019-12-12 14:15:44
问题 ive looked at a few problems on this matter already but couldnt resolve my issue. As you can see below, i save all the objects in my Patient ArrayList ( pList - which is private at the top of the class) into the "Patient.ser" file through serialization. As far as i can tell this is working with no problems. " patSizeAtSave " is a private variable which i am using to mark as a bound to work with when loading the file(see below) the " patModel " is the DefaultListModel i use for the JLists in

How to stop ProGuard from stripping the Serializable interface from a class

百般思念 提交于 2019-12-12 08:27:59
问题 Is there an explicit way to stop ProGuard from changing a class from implementing an interface? I have a class that implements java.io.Serializable , let's call it com.my.package.name.Foo . I've found that after running through ProGuard, it no longer implements Serializable . I get null after I cast from Serializable to Foo and false if I check an instance with instanceof Serializable . I've made sure to set ProGuard to ignore this class: -keep class com.my.package.name.Foo I've also tried:

NotSerializableException even after implementing Serializable

风流意气都作罢 提交于 2019-12-12 04:49:28
问题 Recieving the error: java.io.NotSerializableException even after implementing Serializable. I'm simply trying to serialize a Survey object. Here is my code, does anyone have an idea why I am receiving this error? public void loadData(Survey survey, Test test, Boolean isSurvey) throws FileNotFoundException { ... try { ObjectInputStream ois = new ObjectInputStream(new FileInputStream(fileName)); Survey s = (Survey) ois.readObject(); ois.close(); System.out.println("list size = " + s.questions);

How to send Object value from fragment to fragment in Serializable?

别等时光非礼了梦想. 提交于 2019-12-12 04:23:08
问题 My condition is that i have three fragments A、B、C , i set the value in Afragment and get the value in Cfragment. I want change layout into Bfragment when in Afragment. Compile the project shows Bundle.getSerializable(java.lang.String)' on a null object reference that i change layout into Cfragment when in Bfragment. I want to use Serializable that can let me get the value in Cfragment. How do i finish it ? Any help would be greatly appreciated. My Serializable bean: public class Book