Android :: Pass Data Through New Activity?

Jun 29, 2010

In my Android app,I start a new activity with startActivityForResult(). I get the result in onActivityResult() perfectly. My problem is that there is a small bit of data that I know before I start the activity and I need that value to be available in onActivityResult(), too. I tried attaching it to my intent as an extra, but it wasn't attached to the intent that is available when the activity returns the result. I made it work by storing the data in a global variable, but I really don't like that approach. Is there a better, right way to pass data through an activity (instead of just to it)?

Android :: pass data through new Activity?


Android :: Pass Data To New Activity

Aug 24, 2009

I have two activity in my project. I am callilng second activity from main activity. can some one tell me how can i pass some data to that activity? Simply i want to pass object array. Can some one tell me how can i do it ?

View 5 Replies View Related

Pass Data From 1st To Third Activity In Android

Dec 21, 2012

This is my 1st activity code:

Intent i = new Intent(getApplicationContext(), CustomerLogin.class);
i.putExtra("GrandTotal", mGrandTotal);
startActivity(i);

This is my 2nd activity code:

Intent in = getIntent();
Bundle b = getIntent().getExtras();
String total = b.getString("GrandTotal");
TextView grandtotal = (TextView) findViewById(R.id.grand_total);
grandtotal.setText("Welcome ," + total );

Here the value is pass from 1st to 2nd activity successfully. Now i have to pass these value to third activity.how can i do.

Now this is my 2nd activity:

if(isUserValidated && isPasswordValidated)
{
Intent intent = new Intent(CustomerLogin.this,PayPalIntegrationActivit y.class);
intent.putExtra("GrandTotal", total);
intent.putExtra("login",username.getText().toStrin g());
startActivity(intent);
}

This is my third activity:

Bundle b = getIntent().getExtras();
String total = b.getString("GrandTotal");
TextView grandtotal = (TextView) findViewById(R.id.check);
grandtotal.setText("Welcome ," + total );

Now i have to run the app means am getting the total value on 2nd activity.but am not getting the total value in 3rd activity.

This is my full source code:

1st activity:#5564017 - Pastie

2nd activity:#5564018 - Pastie

3rd activity:#5564020 - Pastie

View 2 Replies View Related

Android :: Trying To Pass Data From Notification To Activity

Oct 30, 2010

I'm trying to pass data from notification to activity.

View 1 Replies View Related

Android :: Pass Data From Thread Into Activity

Jun 12, 2010

I am want to pass data back from a Thread to Activity (which created the thread). So I am doing like described on Android documentation.Only one thing I am missing here - where and how should be defined mResults so I could access it from both Activity and Thread, and also would be able to modify as needed? If I define it as final in MyActivity, I can't change it anymore in Thread - as it is shown in example.

View 1 Replies View Related

Android :: Pass Data To A Child Activity

Nov 2, 2010

I wounder if there is some possible to know from which parent Iam coming from in the child so I can do different stuff depending on who the parent is of the activity.This is how Iam going over to the child. But I don't know how to handle this in the child to check who is the parent. The above code is used on one of the parents,, is there somehow I can use "EQ_CODE_SELECT_LOCATION"? Also I wounder how is possible to send data to a child activity?

View 1 Replies View Related

Android :: Pass Data From Activity To Service Using An Intent

Jul 20, 2010

How do I get data within an Android Service that was passed from an invoking Activity?

View 1 Replies View Related

Android :: Pass Data From BroadcastReceiver Through To Activity Being Started?

Apr 11, 2010

I've got an Android application which needs to be woken up sporadically throughout the day.To do this, I'm using the AlarmManager to set up a PendingIntent and have this trigger a BroadcastReceiver. This BroadcastReceiver then starts an Activity to bring the UI to the foreground.All of the above seems to work, in that the Activity launches itself correctly; but I'd like the BroadcastReceiver to notify the Activity that it was started by the alarm (as opposed to being started by the user). To do this I'm trying, from the onReceive() method of the BroadcastReceiver to set a variable in the extras bundle of the intent,Can anyone tell me what's different about passing a bundle from a BroadcastReceiver to an Activity, as opposed to passing the bundle from an Activity to a BroadcastReceiver?

View 2 Replies View Related

Android : Pass Data From Current Activity To Paused One?

Dec 20, 2009

I wanna know how to pass data from current Activity to paused Activity?

View 3 Replies View Related

Android :: Unable To Get Data From Activity To Service / How Intents Could Pass That?

Nov 24, 2010

I am pretty new to this but I was told I could get good help here. A friend and myself are playing around with creating Android apps (using ADT)

Here is how we are trying to make the program: in activity, user sets threshold values for the X and Y axis on accelerometer. When user hits button "Start", startService is invoked and starts TiltService.

TiltService is designed to run in the background always on the phone without user interaction. TiltService constantly compares the threshold with the accelerometer values and will vibrate if they are off.

My problem is I can't seem to get the putExtra() data correctly. I have overridden the onStartCommand in my service but I get the message "unreachable code" when I save the getExtras() to a bundle.

Here is the relevant code (I can post the whole thing, just do not want to clog up page) code...

I thought I understood the basic of how Intents could pass data, but I guess I don't. Is it obvious what I am missing?

View 2 Replies View Related

Android :: How Can We Pass Two String Values Of One Activity To Another Activity

Jun 2, 2010

first.java String[] items={"one","two"}; Bundle map = new Bundle(); map.putStringArray ("link",items); Intent myintent = new Intent(view.getContext(),two.class); myintent. put Extras (map) ;startActivityForResult(myintent,0); second.java Bundle map=this. get Intent() .getExtras(); String links=map.getString("link"); tell me that how can i get the two string values from one activity to another one. such as links[0]="one"; and links[1] ="two";

View 2 Replies View Related

Android :: Possible To Pass Cursor To An Activity?

Oct 16, 2010

Is this possible? I am trying to open a SQLite database cursor in one activity, and pass it to another activity.

View 2 Replies View Related

Android :: How To Pass Handler To Another Activity

Jul 26, 2010

Assume that there activity A and B, A has a handler, now B is activate by A, how can i pass the handler to B? Currently i have a thread receive messages from socket, and dispatch messages to A and B, I think when B is activated, pass handler to B, then the handler can receive message from the thread. But I don't know how to do.

View 3 Replies View Related

Android :: Pass An Object From One Activity To Another?

Aug 28, 2009

I have an activity which implements an OnItemClickListener.code...

However, I need to pass some objects from MyActivity1 to MyActivity2 --

I see there is an Intent.putExtra() for all the basic types, and I even see a Bundle which is a collection of basic types, but how can I pass a generic "Object" to MyActivity2 ?

View 3 Replies View Related

Android : How Can I Pass Values Of One Activity To Another?

May 31, 2010

How can i pass values of one activity to another?

View 3 Replies View Related

Android : How To Pass Object From An Activity To Another

Oct 15, 2009

There is an activity which has an object. This activity(say A) starts another activity(say B). Can B use some object in A?

View 7 Replies View Related

Android : Pass Image To Another Activity?

Aug 23, 2010

I figured out how to pass a String value between activites thanks to this site, however I'm having trouble passing an image. What I'm trying to to is have a user click a button that opens the gallery and allows selecting of a picture. Then I have another button that opens another activity that displays an ImageView. I want to be able to have that ImageView's image be the chosen one from the previous activity.

Here is the class that has the button I'm clicking to open the gallery and retrieve the chosen image: code...

What I'm not sure about is in the OnActivityResult if I should pass the selectedImage or the chosenimage in the b.putExtra("bitmap", selectedimage); line. I tried both but I didn't see an image on the second activity. Also I wasn't sure in the PreviewScreen class if I'm setting the imageview correctly. Any help is appreciated. Thanks.

View 1 Replies View Related

Android :: How To Set / Pass Values From One Screen (activity) To Another?

Sep 30, 2010

How do you set/pass values from one screen (activity) to another? What I have in the R.layout.main view labeled Calculator contains the code for doing calculations. The main.xml contains the layout (view) of the main screen. I have created an options menu which has another screen which shows you setup (R.layout.setup). The dialogsetup.xml contains the layout (view) for it.

When you press the menu button, you get the options menu. If you select "Setup", then it will display the setup screen. Now what I need to do is take the values from the setup screen (radio button and text values) and place them in the main screen so that when you exit the setup screen and go back to the main screen, you can take those values and use them in your main code.

View 12 Replies View Related

Android :: Way To Pass Bundle To Activity Set As Singletask?

Apr 22, 2010

So I have a MapActivity that runs an asynchtask that occasionally updates what exactly it's displaying on the map (via a string). I originally pass this string in from the intent when the activity is first created. And then if you click on one of the drawables on the map, it opens a new activity, which can then create a new mapview (same class) with a different string setting. The problem I have is that I only want one instance of the mapview to be running at once. Thus I set android:launchmode="singletask" in the manifest. This works in that it brings the mapactivity to the front, but is there any way to send it a new intent bundle to get a new setting for the string it needs? I tried regetting the extras from the bundle, but it seems to retain the old bundle, not the new intent that was passed to it. I'm not sure I want to do startActivityForResult because the 2nd activity may or may not want to update the original activity. I hope that made sense. I can post code if necessary, but I think that should explain my situation.

View 2 Replies View Related

Android :: How To Pass String From Activity To Service?

Aug 30, 2010

On Sat, Aug 28, 2010 at 3:53 AM, Ravi Grandhi <grk.r...@gmail.com> wrote: > How to pass a String from an activity to a service?

View 2 Replies View Related

Android :: Pass Database Results Into New Activity?

Oct 4, 2009

I'm working on an app, and one activity has a worker thread that initiates a database query, and if there are results once it has returned I would like to send these results to a new activity that will display them. Unfortunately I don't see a way to pack the Cursor object into the Intent object that I am using to start the new activity. When I was doing Windows Mobile development in the past all I would do is edit the constructor for the window to pass in the data, I've searched around but I can't find a similar solution for Android. What is the best way to pass my database results into the new activity?

View 3 Replies View Related

Android :: Pass List<GeoPoint> To Another Activity?

Nov 10, 2010

I have an ArrayList of type GeoPoint.

private List<GeoPoint> points = new ArrayList<GeoPoint>();

I want to pass points to another Activity and retrieve the data in that activity. How do I do it? I know I have to use the parcelable but I searched, but could not find a way to pass ArrayLists.

View 1 Replies View Related

Android :: Example Code To Pass Value From New Activity To Old In Droid?

Aug 26, 2010

I am using two Activity as Old Activity and New Activity,i want to pass some value from New Activity to Old Activity.how can i pass the value from New Activity to Old Activity. please give some example code for that.

View 2 Replies View Related

Android :: Pass String From Activity To Layout?

Aug 19, 2010

How can I pass a string from an activity to a layout?
I can pass arrays from an activity to a layout with the following activity code...

Is there a simpler way to just pass a single string instead of any array of strings, from an activity to a layout?

View 1 Replies View Related

Android :: How To Pass String Like Input Of A Activity

Feb 17, 2010

I want to pass a String like the input of a new activity, to let this one use the String some operations. The code I try is this..

And in the activity I try to recover it:

String textout = savedInstanceState.getString("contactcode");

In the onCreate part. I have seen that uris are normally used, but I don't know how to pass that String by using a URI.

View 3 Replies View Related

Android :: How To Pass A Bitmap Object From 1 Activity To Another

Mar 17, 2010

In my activity , I create a Bitmap object, and I need to launch another activity,
How can I pass this Bitmap object from the sub-activity (the one which is going to be launched)?

View 1 Replies View Related

Android :: Way To Pass An Object Array To An Activity

Nov 15, 2010

I have read posts on passing arrays from and to activities, but I am confused as to how I would do it for my specific case.

I have an array of objects called DaysWeather (a DaysWeather[] array) where the objects have several String attributes as well as a bitmap attribute. I read somewhere that you have to make it serializable or parceable or something, but it seems messy at first glance.

Could someone lead me in the right direction?

Is there a simple way to do this?

View 1 Replies View Related

Android : Can I Pass A File Created In Activity To Another?

Jun 26, 2009

I create a local file in my activity like this: How can I pass the URI of this file to another Activity? And do I need to set any permission (file permission, manifest permission) to allow other Activity to use that file?

View 5 Replies View Related

Android : Want To Pass Array Strings From One Activity To Another

Feb 15, 2009

I have two activities. I want to pass array strings from one activity to another. I am using putStringArray and getStringArray functions. But still its not working. Could you please let me know how can I do it? Is there any other way to do it?

View 3 Replies View Related

Android : Pass Values From One Activity To Previous?

Jul 14, 2009

Can any one tell me how to pass the value from one screen to its previous screen. Consider the case.i m having two screen first screen with one Textview and button and the second activity have one edittext and button. If i click the first button then it has to move to second activity and here user has to type something in the textbox. If he press the button from the second screen then the values from the textbox should move to the first activity and that should be displayed in the first activity textview.

View 4 Replies View Related







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