Android :: Switching Activities / Passing Data Between Activities

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?

Android :: switching activities / passing data between activities


Android :: Passing ArrayList Across Activities

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

Android :: Blank Screen When Switching Activities / Fix It?

Apr 25, 2009

I've got a basic list activity with a few images that when you select one starts a new activity with a SurfaceView (based on the Lunar Lander sample). Some times the screen is just blank, from some debugging I can see that the background .png is being loaded and doDraw() is being called by the activity doesn't display anything for anything from 4 to 20 seconds. Other times the game activity is loaded just fine. I assumed it was some kind of garbage collection problem but I can't see anything in LogCat and the second activity is actually loaded, just not displayed for some reason.

View 2 Replies View Related

Android :: Multiple Activities Or Switching Views Manually

Jan 15, 2010

I have developed some apps for Android, and this questions stays always:

How should I structure my UI? Should I launch activity after activity and leave the phone to make the "back" button, or should I choose more optimized, but more complex to implement, way with switching manually Views and then manually doing the "Back" button functionality?

View 4 Replies View Related

Android :: Switching Activities Back / Need To Make GridView Again?

Sep 22, 2010

I'm starting on Android and got a beginner question on switching between multiple activities. I understand i can go between two activities by invoking an intent and then returning with setResult(). What I want to know is how to jump between multiple activities. Specifically I want to learn about the process life-cycle. I understand how every activity is started ar onCreated(), but I'm not sure how to implement onResume() or onRestart() when I want to come back. So basically I have 3 activities: Activity1, Activity2 and Anctivity3. I start with Activity1 and then invoke Activity2 with an Intent, and Activity2 invokes Activity3. Using buttons. Now I want to come back to Activity1 from Activity3. I do the same thing here too. Make an Intent and call startActivity(Activity1_Intent). But it gives a runtime error.I think I need to implement OnResume() or onRestart(), but I'm not sure how to do this. In onCreate() I make a gridView, so when I come back, do I need to make that gridView again? If anybody could give a small explanation of refer to a tutorial it would be great.

View 1 Replies View Related

Android :: Switching Activities In Phone Start A Fresh JVM?

Mar 18, 2010

Does switching activities in Android start a fresh JVM? It seems like each activity is meant to run as its own "main" method. If I have a singleton (via Guice, not an actual singleton in this case) should I expect to be re-creating it every time I switch activities?

View 1 Replies View Related

Android :: Switching Tabs From Activities Inside Host

May 9, 2010

Currently I have a TabHost implemented with 3 tabs each containing a separate activity. My question is how do I switch between tabs from within one of the activities that is located inside the tab host. ie say i have a button inside one of the tabs[tab 1], when i click on this button it should switch to another tab[tab 2]. To understand my problem click on the link below, http://stackoverflow.com/questions/2541802/android-switch-tabs-from-w.

View 3 Replies View Related

Android : How To Dismiss A Popup Window When Switching Among Tab Activities

Nov 21, 2010

I posted a StackOverflow question here (http://stackoverflow.com/ questions/4226898/dismiss-android-popupwindow-when-switching-to-a-new- tab-in-tab activity/4227034#4227034) but it didn't get any responses. Basically, how can one dismiss a PopupWindow when changing to a different TabActivity? The onPause() method in my TabActivity causes the app to force close.

View 2 Replies View Related

Android :: Data Between Activities

Jun 30, 2009

Is it possible to transfer data between activities without using "extars"? I need to access MyOwnObject in Atctivity 1 from Activity2 Possible with using static fields?

View 6 Replies View Related

Android :: Pass The Data To Sub Activities?

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

Android :: Pass Data Between Activities?

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

Android :: Sharing Data Between Activities

Apr 7, 2010

I was playing a bit with adapters cursors and activities. Let's assume i have a cursor containing a query I've made (it doesn't matter if it's to DB or content provider). Now lets assume i bind some of the data (first two rows) to a list activity. Every click on one of those items should open a new list activity (i pass on the cursor index in the activity bundle). Now the question is, which sharing method will be most efficient and right from code point of view ?

1. I thought of trying to send the cursor object in the intent itself (hoping it implemented runnable) but I'm not so sure it's that efficient since the query may contain many rows which will need to be parceled, and i the other intents uses only a few (say 4-5 columns of each row) it's a real waste.

2. Thought of trying to create the array list for my other list screen adapter and serialize it to the intent (again use serialize and intent to pass on the data) but again i fear for efficiency penalty.

3. my last solution was to use static cursor member in my first activity, with package permission, it will work and be relatively efficient, but I'm not so sure regarding memory efficiency and code structure, i'm not fond of using static variables in any case.

Is there another sharing method that i don't know off, if two activities share the same process and application, then they also share memory space, then it should be easy to pass variables from one to another, the question is what's the easiest way without serializing ?

View 6 Replies View Related

Android :: Sharing Data Between Tab Activities

Aug 10, 2010

I did some digging, but couldn't find a clear answer. I have an application with TabActivity as the main activity. I have some computing and network communication that needs to be done when user clicks on the big red jolly "DO IT" button. One tab hosts the form with "DO IT" button, while the other tabs display the results from computing (each tab displays different part of results). The computing is done as AsyncTask as it's supposed to be (afaik).

Now the question is, what is the best way to share the results between the tabbed activities? It can be done with ContentProvider + database from what I have read, although that seems like a bit too much for my needs. I have also considered an option to save the results to some cache file activities could read in onCreate, onResume etc and display the data. Are there any other convenient ways to share the data? (To make it more clear, the data aren't simple, so doing it through preferences etc is impossible.)

View 5 Replies View Related

Android :: Sharing Data Across Activities

Mar 13, 2009

I was looking out for ways to share data between various activities that one may need to create for his applications . Using "Parcel" and Bundle one can do data exchange , but looks like this is a bit cumbersome process specifically if you have to share large array objects with too many fields.

As android.app.Application maintains global state for the application , we can use this class to store global data and access it across activities. Is this a good way ? Are there any implications on allocating large objects in the your class which extends from android.app.Application ?

View 6 Replies View Related

Android :: Send Data Between Activities Within My App?

Mar 9, 2010

I have a TabActivity, and the tabs point to sub activities. Is there a way I can send a 'message' to those child activities? I just want to pass a string across, not sure if this is possible.

I have some data being fetched by the parent TabActivity, and the child tabs can't do anything useful until the parent is done fetching. When fetching is complete, I'd like to pass that data to the child activities so they can do something useful with it.

Normally I'd set the data to be passed in the Intent when first creating the activity, but in this case I can't do that.

View 2 Replies View Related

Android :: Sharing Data Amongst Activities And Services

Aug 23, 2010

I am working on a small android project where it is necessary to share some data amongst several activities and a service that runs in a separate process. I would just like to know what are my options in terms of sharing data? Application class? IPC? File-based? Broadcasts?

View 3 Replies View Related

Android :: Exchange Data (objects) Between Different Droid Activities?

Jul 29, 2010

What is proper way to exchange data or objects between different Android Activities?

Welcome screen <-> Main Screen <-> Startup routines <-> Processing data <-> Settings

Is it normal/recommended to have more than one activity in Android app? in my opinion, it's somehow strange to have this model of data exchange inside application

View 3 Replies View Related

Android :: Pass Data Between Activities In Droid Application?

Jun 3, 2010

How to pass data between activities in an Android application?

View 1 Replies View Related

Android :: Pass Data Between Activities - HashMap Of WeakReferences To Objects

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

Android :: Sharing Data Between Activities / Activity2 A Pointer To Object1

Jul 22, 2009

I have been using SharedPreferences to share data between activities. But I would very much like to find a better way. I would simply like both Activity1 and Activity2 to share Object1. Activity1 will create Object1 and then start Activity2. What is the smartest way to give Activity2 a pointer to Object1?

To summarize: Activities don't have constructors! How do I send data to them from their parent activity?

View 17 Replies View Related

Android :: Send Data To Multiple Activities In Controlled Manner?

Jun 26, 2010

I am working on an android application, where there are 4 activities. Activity1 is main activity and there are different buttons on that activity which can open other activities. Other 3 activities can also open each other. There is a thread running in Activity1 which returns some counter. I need to show that counter on all activities. At an specific time, the thread doesn't know which activity is at top. What is the right way to control this scenario, such that thread output should update on all activities, no matter which one is at top?

View 1 Replies View Related

Android :: Singleton Objects To Save State Or Share Data Between Activities?

Nov 24, 2010

It would be nice if StackOverflow had a section where we could post tutorials like mine so that I can answer literally hundreds of questions that have been asked here with a single blow. See... every day I read questions about how to pass complex objects between activities, how to save state so that your app can resume after orientation change, how to update listviews when the data changes, etc, etc. Here is the second part of a tutorial series I posted on my blog... I hope that you actually read it... because I haven't seen any examples like it anywhere... and it has changed how I think about developing for Android across the board. The question is... is there a downside or negative affect of developing like this?

Beyond Smart Lists - How Observable Singletons change the game. Please read through both of these tutorials carefully... I will answer any questions about it here that I can... I really want to know what you think about this and if it might solve issues for you. NOTE TO MODERATORS: there are no advertisements of any kind on my blog.. so don't just close this because you think I am spamming somehow... I am not going to duplicate my post here.

View 1 Replies View Related

Android :: Practices On Droid To Keep Data Between Activities Deathes / Restarts For Whole App Session?

Jan 9, 2010

We're designing an Android app that has several activities which are working in a wizard like way - user should pass from the activity #1 to activity #5 to get to the final activity (#6).

Since we know an activity can be suddenly terminated by OS on low memory we used Application class as a static storage for keeping the data the user inputs on "wizard" activities and other data our app needs for the whole session.

Unfortunately we've discovered this approach fails - looks like the Application class instance is also can be killed by OS (this was specifically discovered on Android 1.6 versus 1.5). Are our expectations wrong on this approach (we think Application class instance always lives for the whole app session)?

So the question is - what is the best practices on Android to keep data between activities deathes/restarts for the whole application session?

View 2 Replies View Related

Android :: Pass Data Between Activities In Android?

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

Android :: When To Use More Activities?

Nov 14, 2010

I have an Activity which is an OpenGL view. I also have an xml layout to use for preferences. Until now, to show the preference menu, I just brought it to front by setContentView(). And the same to get back to the OpenGL view. But is this a case where I should give the preference menu its own Activity? I guess this would make a few things much easier. For example, the back button would just work, opposed to now where I have to code it or it will just exits the application.And if this is a good idea, how do I pass data both ways? I have a class that store all preferences. Can I send it to the Activity and back again? Or is the best way to store the preferences in a sqlite database and then use it for passing data?

View 2 Replies View Related

Android :: How To Communicate Between 2 Activities?

Apr 22, 2009

I have read 'http://developer.android.com/guide/tutorials/notepad/notepad-ex2.html', specifically step 4 ahow can I return a different result to the 'calling activity', in this example, it always return ACTIVITY_CREATE. What if the 'activity being launcher' has a 'okay' and a 'cancel' button. How can the 'calling activity' knows which button user presses in the 'activity being launcher'.

View 3 Replies View Related

Android :: Way To Swap Activities?

Aug 15, 2010

Right now I have 2 activities (A+B) and what I would like is for only 1 of them ever to be on the stack (If A shows B, I want the back button from B to go to the home screen not A). Is their a good way of doing this with activities Or should I change my app to be a bunch of views?

View 5 Replies View Related

Android :: How Can I Get All Name Of Activities In System ?

Apr 15, 2010

In my project ,I need get all the name of the activities ,not only my own application, but also the third party application , and how can I get?

View 3 Replies View Related

Android :: Launching Activities Within Tab

Aug 20, 2009

I have an application with three tabs. Through various interactions with the items in the tabs I end up launching other activities. The client has reviewed this and would like the activities launched "within" the tabs, so the tabs remain visible and if the user clicks the tab it goes back to the original activity defined in the setContent function. Is this possible and how would I go about this from other activities? (ie the child activities, not the one that defines the TabHost and has access to call setContent)?

View 4 Replies View Related

Android :: App With Multiple Activities

Feb 8, 2010

I have a very simple game that consists of only one activity, and I want to add a title screen.If the title screen is another activity, what changes do I need to make to my manifest file to make the title screen open first?The gameplay activity is called Leeder, and the title screen activity is called LeederTitleScreen.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved