parcelable

Send a cursor to an activity from a service

时光毁灭记忆、已成空白 提交于 2019-12-12 00:59:33
问题 I'm trying to send database cursor from a service(An IntentService) to my Activity(Which implements a Receiver to catch any response from the service). Once i get the data from query cursor = db.query(DBHelper.DB_BOOKS_TABLE, columns, where, whereArgs, groupBy, having, orderBy); i would like to send back the cursor from the service to his caller thru the receiver. but the bundle structure just let me send tical data(Strings, ints, thinks like that). i know the bundle also let send parcelable

AsyncTask passing custom objects

心不动则不痛 提交于 2019-12-11 23:29:01
问题 [I have a custom parcelable object Vehicle] I have looked at AsyncTask but it wasn't too clear on this topic: I would like to pass a String(which is the Vehicle ID of the Vehicle) into an AsyncTask, then in doInBackground() I have a method mRemoteInterface.getTrackHistory(); which gives me an ArrayList. I would like to then, in onPostExecute() start an activity where both the Vehicle ID and ArrayList are extras. This is an outline of what I wan't to be able to do. The issue is that I don't

parcelable ArrayList passed partially with null elements

北慕城南 提交于 2019-12-11 21:14:55
问题 when i pass an array between intents as a result to startActivityForResult I get a partial array back ArrayList<User> currentUsers = ... Intent resultIntent = new Intent(); resultIntent.putParcelableArrayListExtra(USER_ARR, currentUsers); setResult(Activity.RESULT_OK, resultIntent); ArrayList<User> users = data.getParcelableArrayListExtra(USER_ARR); User implements Parcelable, and it is built correct for sure, I changed something in the passing of the array and now when it sends the array it

In kotlin how to make a derived class from a Parcelable parent (and has implemented a nested Builder class)?

▼魔方 西西 提交于 2019-12-11 17:48:55
问题 Having a base class (which is Parceable) using Builder pattern, now would like to create a child class derived from it so that override the default customFunc_1 and customFunc_2 function implementation. If simply deriving from the base class, class DerivedDataConfig : BaseDataConfig { override open fun customFunc_1(context: Context, savedInstanceState: Bundle?, onElementClickListener: ElementClickListener? = null) : FrameLayout? { // differnt than base Log.i("+++", "+++, customFunc_1 called

How to implement Parcelable object for my class?

徘徊边缘 提交于 2019-12-11 15:26:37
问题 I have class which is used to create Client that connects to a Server. It has the following members: public class MyClientThread implements Runnable, Parcelable { private TextView ClientServerMsg; private Integer PortNumber = 4545; private String IPAddress = "127.0.0.1"; private Activity activity; private Socket clientSocket; } When the user rotates the screen, all the client object data is lost/reset and the client has to be reconnected with server. While implementing writeToParcel method, I

EXTRA with parcelable comes out NULL but without its fine

試著忘記壹切 提交于 2019-12-11 13:19:14
问题 I am getting a bit frustrated with an issue that I cannot seem to fully understand. I have a listview with items and when I click them I want to pass an object (Parcelable) to a new activity. This is the code below: lv_Entries.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Intent getItchesScreen = new Intent(Home.this, Itches.class); getItchesScreen.putExtra("i", 3); Entry e = entries.get

How to put Simple XML Serialization model-objects into a Bundle?

北战南征 提交于 2019-12-11 11:17:41
问题 I am using the Simple XML Serialization library in my Android app for parsing and mapping an XML response from a web service to objects, like so: @Root(name="root_tag", strict=false) public class XMLRequest { @Path("a/b") @ElementList(name="routeList") private List<Route> routes; public ArrayList<Route> getRoutes() { return new ArrayList<Route>(routes); } } I have several more dependent model-classes (like Route ) written in a similar way with the proper annotations, the parsing an mapping

Difficulty with unmarshalling in parcelable

人走茶凉 提交于 2019-12-11 09:22:29
问题 Here is my code of writing to a parcel public void writeToParcel(Parcel dest, int flags) { dest.writeString(poiDescription); dest.writeString(latitude); dest.writeString(longitude); dest.writeString(placeName); dest.writeString(plistPath); dest.writeString(poiDirName); if (null != isMascotPresent) dest.writeString(isMascotPresent); if (null != startMascottTime) dest.writeInt(startMascottTime); if (null != mascottDuration) dest.writeInt(mascottDuration); } public PointOfInterest(Parcel source)

Proguard with Parceler and Realm

断了今生、忘了曾经 提交于 2019-12-11 06:54:27
问题 I'm using Realm and Parceler and everything is working fine but when I enable the Proguard I'm getting an error when doing: Parcels.wrap(obj) I'm getting the following error: org.parceler.ParcelerRuntimeException: Unable to find generated Parcelable class for io.realm.g, verify that your class is configured properly and that the Parcelable class io.realm.g$$Parcelable is generated by Parceler. Although I have configured the proguard rules like: ##---------------Begin: proguard configuration

Android: Having Difficulty passing an Object from one activity to another using Parcel

别来无恙 提交于 2019-12-11 05:15:02
问题 I've read MANY articles on how to use Parcel and I've used it in my app but it isn't working. I've just created an activity where you can connect to a computer using Sockets . I've opened a java.io.PrintWriter on the Socket's OutputStream and I want to have another activity (which is opened on touching a button in the 1st activity) use this same PrintWriter . I think the mistake I'm making here is of not cloning PrintWriter object . I don't know how to clone it. Here's the 1st Activity (I've