Android :: Pass Remote Interface (aidl) Throughout Activities?
May 13, 2010
I am developing an application using services and Remote interface. I have a question about passing the reference of my Remote interface throughout Activities. In my first Activity, I bind my service with my activity, in order to get a reference to my interface I use
private ServiceConnection mConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName arg0, IBinder service) {
x = X.Stub.asInterface(service);
}
@Override
public void onServiceDisconnected(ComponentName arg0) {
// TODO Auto-generated method stub
}
};
x being the reference to my interface. Now I would like to access this interface from another activity, I see two ways to do it but I don't know which one is the "proper" way to do it: passing x with my intent when I call the new Activity redo this.bindService(new Intent(y.this,z.class), mConnection, Context.BIND_AUTO_CREATE); in the onCreate() of my new Activity
View 1 Replies
May 16, 2009
I didn't find a sufficient answer to my problem in any posts, if there already is one, please excuse and point me to it, thanks. I made 2 projects. project 1 hast an activity that binds to a service from project 2 on a button click (all just for testing).
How can I make project 1 know (import) my TestInterface (from TestInterface.aidl out of project 2) for usage in: "TestInterface mService = (TestInterface) TestInterface.Stub.asInterface(service);"
without adding project 2 to the build path, because if I'd have an installed service without the project code, I couldn't do it this way, too...?? I read in one thread that TestInterface.aidl should just be added to project 1, too, but if I do this, in DDMS enforceInterface() complains and seems to just see/use the interface from project 1 and it doesn't work.
2. issue:...............
View 9 Replies
View Related
Jul 26, 2010
In the implementation of my remote service's published API, is there a way to identify which client called a given method? For example, is there a way to obtain a unique ID or address of the caller? I already cache an AIDL callback reference to the client, but not sure how I can use this for identification.
View 4 Replies
View Related
Sep 23, 2009
Been using remote interfaces for quite a while now, but the time has come to increase the amount of data i need to pass between processes. Following the Designing a Remote Interface using aidl examples/ tutorial i have had some success but have now come to a problem.
My activity binds to my service no problem, the callbacks work, but the data i send does not reach the client. My code is an extension of "Pass by value Parameters using Parcelables" from the "Designing a Remote Interface using aidl" page. The only difference is the amount of data, it has 18 int's and 3 Doubles. As you will see below, once i have entered the data into the parcel, i create my Parcelable using .createFromParcel(p) this however does not seem to work, even when my Parcelable is reading from the parcel no data gets read.
Here is my code for sending the data to the client.
CODE:..............
Here is my Parecelable:
CODE:....................
View 4 Replies
View Related
Aug 30, 2010
I want to pass an object from Activity B to Activity A. Scenario:
- Activity A calls Activity B
- User selects item in Activity B
- Activity B passes an object to Activity A
How do I accomplish this? And in which method do I read in the passed object in Activity A?
View 2 Replies
View Related
Jul 2, 2009
The main activity includes some variables with set values. I created a sub-activity with the form which has to be filled with the data from main activity so I guess the data have to be passed to the sub-activity when it starts. how to pass the variable values to the sub-activity from the main activity?
View 1 Replies
View Related
Oct 6, 2010
I'm developing an app which basically navigates through a xml-feed. When I parse the feed or let's say the list, then each (list)item becomes a model. All the models are wrapped up in an array list. Now, when the user clicks on a list item, the underlying model is going to be serialized and sent as IntentExtra to the next Activity (e.g. a deeper sub list). (Originally I asked here a different question. The solution was not related to Serializable and wouldn't help anybody. However MatteKarla gave an interesting input. Thats why I decided to rewrite this question.)
View 1 Replies
View Related
Jan 3, 2010
How can we pass checked box status from one activity to the calling activity? For e.g., I have two activities. The first activity calls the second activity that has a listview with checkboxed items and two buttons, 'OK' and 'CANCEL'. The second activity has to pass the names of list items that are checked to the calling acitivity. I am not able to figure out how to do this efficiently?
View 4 Replies
View Related
Apr 19, 2010
Today I met a problem, I need to pass a ArrayList<MyClass> from an activity to another. I dont know what the Intent exactly do when I use putExtra to pass in an ArrayList<MyClass> object. I guess MyClass need to implement Parcelable interface, so I just did it. But still, it does not work. Maybe I need to create a Bundle and then use Bundle's putParcelableArrayList method to put my ArrayList<MyClass> object in, and then pass this bundle as parameter of putExtra to the intent. So crazy! I am lazy, I just want to pass an ArrayList<MyClass> object simply, is there a simple way??
View 10 Replies
View Related
Oct 18, 2009
I am trying to pass a user defined object to another activity Bundle bundle = new Bundle(); bund.putSerializable("myData", myData); intent.putExtra("bundle", bundle); where myData class implements Serializable interface. I am getting following error: java.lang.RuntimeException: Parcelable encountered IOException writing serializable object how to pass complex objects between activities?
View 7 Replies
View Related
Nov 17, 2010
I have an Object that I need to be able to pass between Activites. It implements Parcelable and I've written all the code related to that. The problem is that one of the properties of the Object is a Drawable - and really needs to be. Unfortunately, Drawable is neither Parcelable or Serializable. I don't understand how to pass it. The reason for having the Drawable is that I need to cache an Image that I've downloaded from the internet at runtime. I don't want to cache the images on the filesystem, since this would potentially end up using up a lot of space over time. I'm putting the image into a Drawable so that I can easily put it into an ImageView.
View 2 Replies
View Related
Dec 8, 2009
I'm working on an application that requires non-serializable objects to be passed between Activities. The following page suggests using a HashMap of WeakReferences to accomplish this:
http://developer.android.com/guide/appendix/faq/framework.html
Is this solution safe? I know Activities are completely destroyed and recreated when the screen orientation changes. Couldn't those weakly referenced objects get GCed in the split second when the screen is rotated, since they wouldn't be referenced elsewhere at that point?
View 3 Replies
View Related
Jun 3, 2010
How to pass data between activities in an Android application?
View 1 Replies
View Related
Nov 16, 2009
I am trying to pass a custom object to one activity from another. What I would like to use is the HashMap of WeakReferences, but the description isn't clear, at least to me. From above URL: "A HashMap of WeakReferences to Objects. You can also use a HashMap of WeakReferences to Objects with Long keys. When an activity wants to pass an object to another activity, it simply puts the object in the map and sends the key (which is a unique Long based on a counter or time stamp) to the recipient activity via intent extras. The recipient activity retrieves the object using this key."
MyObject object = new MyObject(); HashMap map = new HashMap(); WeakReference reference = new WeakReference(object); map.put(reference.hashCode(), reference);
Intent i = new Intent(myIntent); i.putExtra(map);
I know this is probably way off but I can't figure out how this is intended to be implemented based on the description. Are the keys hashcodes, user defined, or what? It sounds like all that is passed is a HashMap containing the key values but how is the object retrieved with just the key? I couldn't find any code examples or useful documentation on this method of passing objects
View 3 Replies
View Related
Jun 29, 2010
How to pass socket, inputstream, outputstream objects between activities
View 1 Replies
View Related
Jul 16, 2009
This is my aidl file.
CODE:.................
View 3 Replies
View Related
Feb 17, 2010
The object passing between an Android service and the remote binder is happening through serialization of the object. If the service needs to return a very large collection, it seems very inefficient to use this. What is the recommended way to deal with this?
View 1 Replies
View Related
Oct 15, 2010
How can I pass a Object: ArrayList from one Activity to another? Seems that intent cannot hold custom ones except ArrayList. As a kind of hack, I use a static member: staticResultList = new ArrayList<SingleExamResult>(m_examResults); and Get it in the following Activity by: m_examResults = DoExam.staticResultList; It's not the correct way obviously, any 'common' approaches?
View 1 Replies
View Related
Nov 12, 2010
class1.java has creates a float[] array that is need to have in class2.java. How do you do this? The float[] is points. Here is an example code:
class1.java
import android.app.Activity;
import android.content.Context;
import android.app.ListActivity;
import android.content.Intent;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Typeface;......................
View 4 Replies
View Related
Oct 26, 2010
The FAQ mentions a method of passing objects around activities. (It is not clear to me): "A HashMap of WeakReferences to Objects. You can also use a HashMap of WeakReferences to Objects with Long keys. When an activity wants to pass an object to another activity, it simply puts the object in the map and sends the key (which is a unique Long based on a counter or time stamp) to the recipient activity via intent extras. The recipient activity retrieves the object using this key.".................
View 7 Replies
View Related
Jan 19, 2010
i have a scenario of login page after logging in there will be sign out button on each activity. on clicking signout i will be passing session id of signed in user to signout. can any one guide me how to keep session id available on all activities??
View 3 Replies
View Related
Jul 13, 2010
I was just on there yesterday i go into browse tonight and now all of a sudden it says pass world invalid from last night till this morning i tried typing in the little letters they had and I cant read it so I go to the google site. I put the info in and it says sorry account has been terminated for terms and conditions I didnt even do any thing to violate them?
View 1 Replies
View Related
Jul 26, 2010
added a quick demo video of our upcoming Android Infrared (IR) Remote.Initially it will support a full IR dbase of 300,000+ IR codes, IR learner for any code not in the dbase, Pre-Built GUI so it is simple to setup. Will add rs232, relays, and other tcp options also after initial release.
View 5 Replies
View Related
Jun 30, 2010
how to call BarCodeScanner, and return the value to a field.so now, i have a toast that says "successful scan" and then i want to pass the result to a new activity. when i comment out my intent, everything works (minus the passing of data/switching of screen, obviously) but when i run my project as is, it FC's no errors reported by eclipse in code or xml. any insights?
View 2 Replies
View Related
Aug 1, 2010
Looking for an App to remote to my desktop.I am trying to see if I can access magicjack on my desktop and make true voip calls.
View 2 Replies
View Related
Jun 17, 2009
I create an aidl file named mp3PlayerInterface.aidl. Then I try to use the aidl tool to parsing the aidl-file to java-file. The error"mp3PlayerInterface should be declared in a file called com mp3playermp3PlayerI nterface.aidl."happened no matter use the aidl-command derectly or eclipse.
View 2 Replies
View Related
Aug 20, 2009
I sent a intent to call a service interface which returns a parcelable object.
but get errors...
View 2 Replies
View Related
Aug 12, 2010
I downgraded to Eclipse 3.5, and the following still doesn't happen when I build a project in Eclipse:
1. .aidl files don't get processed (at all).
2. R.java isn't generated.
Used to work. What the heck?
View 3 Replies
View Related
Sep 29, 2009
I get the android source. How can I build the aidl too that is part of android (the one which generates java file from an aidl file)?
View 2 Replies
View Related
Oct 14, 2010
I'm unable to find the AIDL tool in my OSX install. My tools directory does not have AIDL, but it has everything else (Adb, android, ddms, etc). I've tried opening the SDK and AVD manager and reinstalling the Android SDK Tools Rev 7, no luck. Any idea on how I can get a hold of the tool? Is there a separate download I can use?
View 3 Replies
View Related