Send Data to the other Activity

by Android » Wed, 07 Jan 2009 18:27:02 GMT


Sponsored Links
 Hi,

I am trying to start a new Activity from my Activity. For this am
creating an intent as

Intent sendIntent = new Intent(this,Newactivity.class);
startActivity(sendIntent);

With the above i am able to launch my new Intent.
If I want to send some data from Current Activity to the Newactivity
(Where my Newactivity have a text box). The data i send from
CurrentActivity to Newactivity should be displayed in this text box.

Can anyone help me out how to do this ?

Thanks.

--~--~---------~--~----~------------~-------~--~----~



Send Data to the other Activity

by Mark Murphy » Wed, 07 Jan 2009 21:01:27 GMT


 


You'll want to use the "extras" in Intents. Look at putExtra() and the
corresponding getXXXExtra() (where XXX is some data type).

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com 
_The Busy Coder's Guide to Android Development_ Version 1.9 Published!

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Send Data to the other Activity

by PRATAP SOLAPUR » Fri, 09 Jan 2009 00:01:17 GMT


 To your Intent add the data using
putExtra()
method and in the second activity in which u want to display use
getIntent().get.Extra()
 to retrieve ur data n then display








--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Geopoint not giving the correct location

Hi,
I am using Android 2.0.1 with Google APIs. I wrote a simple app using
ItemizedOverlay. here is the code snippet:

super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        linearLayout = (LinearLayout)findViewById(R.id.zoomview);
        mapView = (MapView)findViewById(R.id.mapview);
        //mapView.setSatellite(true);
        mapView.setStreetView(true);
        mapView.setBuiltInZoomControls(true);

       drawable = this.getResources().getDrawable(R.drawable.icon);
        itemizedOverlay = new HelloItemizedOverlay(drawable);

        Double lat = 37.2591264 * 1E6;
        Double ln = -121.968505 * 1E6;
        GeoPoint point = new GeoPoint(lat.intValue(),ln.intValue() );
        OverlayItem overlayitem2 = new OverlayItem(point, "", "");
        itemizedOverlay.addOverlay(overlayitem2);
        mapOverlays.add(itemizedOverlay);


 ItemizedOverlay class:-

public class HelloItemizedOverlay extends ItemizedOverlay {
        //Context ma;
        private ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>
();
        public HelloItemizedOverlay(Drawable defaultMarker) {
                super(boundCenterBottom(defaultMarker));

                // TODO Auto-generated constructor stub
        }
        public void addOverlay(OverlayItem overlay) {
            mOverlays.add(overlay);
            populate();
        }
        @Override
        protected OverlayItem createItem(int i) {
                // TODO Auto-generated method stub
                return mOverlays.get(i);
        }

                   @Override
        public int size() {
                // TODO Auto-generated method stub
                return mOverlays.size();
        }

}

when I run the above code, i do not get the correct location on the
map . it points to location Tulsa in Okhlama state while I was
entering the coordinates for Los Gatos , CA.
Even the icon is missing.

However when i use the Map Controller and  call animateTo(point) , i
get the correct location.

I am not sure what is wrong?.

would appreciate any pointers here..

--

2. Forward GeoCoder usage for listing business..

Hi Folks,
anyone had luck using forward geocoder calls to list business address
latitude/longitudes using ..getFromLocationName(address, maxresults).?
what i found out was that the above would work if we have a specific address
, say ,"1600 amphitheater way, mountain view, CA"  or just use the locality
address , say, " Mountain view, CA" but does not work for example if you say
" wholefoods , mountain view, CA.".

any tips on how to make business search..

thanks
Sunil.

--

3. HelloAndroid.apk has a CERT.RSA File of Size 0

4. Eclipse : Android Manager & AVD cannot start due to missing platform

5. SurfaceView looses focus and doesn't restore it?

6. Questions on 2.0 vs 1.5 and what device to buy

7. linux eclipse adt can't find valid paths