Android :: Pass ArrayList Parameters Between Two Activities
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
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
Oct 27, 2010
I want to pass an Arraylist from one activity to another. I use putStringArrayListExtra(), but there shows an error : "The method putStringArrayListExtra(String,ArrayList is undefined for the type bundle." Is there any other method available for passing ArrayList?
CODE:..................
View 3 Replies
View Related
May 23, 2009
This maybe a silly question, but I was wondering how to pass multiple parameters to AsyncTask
I have something like ,code...
I would like to pass in the 3 parameters , I am not sure (1) if it is possible and (2) what the syntax would be .
View 3 Replies
View Related
Oct 29, 2010
I am writing a class in Android that requires certain parameters from the class that calls its functions.
For Example my class is called "DoStuff"
DoStuff has 3 functions:
CODE:.....................
Is there a way for me to have canvas, tick and toggle implicetly passed to the "DoStuff" when I call on it's functions from somewhere else (that somewhere is unknown to DoStuff).
View 3 Replies
View Related
Feb 10, 2010
When providing a user on a mobile, a link to an android application via a web page, it is possible for params from the url to be passed to the app being installed.
I'm guessing the answer is no - but it doesn't help to ask.
The reasoning being that it would be handy for some situations to have a generic app that pulls config information from the referrer.
View 2 Replies
View Related
Mar 13, 2010
I can establish a connection using HttpUrlConnection.
My code below.
CODE:....................
Getting filenotfound exception. dont know why?
How to pass username and passwrod parameter to the url by code..
View 2 Replies
View Related
Jun 19, 2010
I use an AsyncTask for loading operations that I implemented as an inner class. In onPreExecute() I show a loading dialog which I then hide again in onPostExecute(). But for some of the loading operations I know in advance that they will finish very quickly so I don't want to display the loading dialog. I wanted to indicate this by a boolean parameter that I could pass to onPreExecute() but apparently for some reason onPreExecute() doesn't take any parameters.
The obvious workaround would probably be to create a member field in my AsyncTask or in the outer class which I would have to set before every loading operation but that does not seem very elegant.
View 2 Replies
View Related
Oct 13, 2010
I want to implement a generic, thread save class which takes the RessourceId of an ImageView and the Url (http) where the desired image file is stored. It'll download the image and fills the src of the ImageView in the UiThread.
I thought AsyncTask would be the best thing for me. However I noticed that I only can pass one type of parameters to the doInBackground() Method. Like an Array of Urls. Is that true? What would u suggest me?
View 1 Replies
View Related
Jun 17, 2010
I am working on an app that has multiple tabs. In the first tab the user will enter values. In the other tabs it will display the results of calculations based off of those values.
Like in tab 1, the user will enter "3" and "2". In tab 2, the program will add them and display "5".
In tab 2 how do I access the ints "3" and "2"?
View 1 Replies
View Related
Oct 15, 2010
what parameters do I pass to this function? invalidate(left, top, right, bottom) for use with google map on android ?
View 1 Replies
View Related
Apr 7, 2009
I have an ArrayList<MyList> aList in an activity. I would like to send this data to another activty. Such that,
ArrayList<MyList> aList;
Intent intent = new Intent(); intent.setClass(mainactivity.this, newActivity.class); intent.putExtra("MyList", aList ); startActivity(intent);
On the receiving activity,
Intent i = getIntent(); newList = (ArrayList<MyList>) i.getSerializableExtra("MyList");
But this gets me no where. ERROR! My intention is to share this List between activities.
View 4 Replies
View Related
May 23, 2010
Is it possible to pass the android market place parameters for later use for example: request id?
View 2 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
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
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
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
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
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
Apr 20, 2010
In requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this); if I put time interval and distance as zero, will this work, or shall I need to give a value greater than zero.
View 4 Replies
View Related