I want to send my location(address) from my fragment activity to another activity and show the address there. I tried for last couple days but not failed every time. please guide me.
            Asked
            
        
        
            Active
            
        
            Viewed 796 times
        
    0
            
            
        - 
                    1"I tried for last couple days but not failed every time" - what have you tried specifically? – Mike Dinescu Mar 03 '14 at 03:36
- 
                    Check this one: http://stackoverflow.com/questions/9343241/passing-data-between-a-fragment-and-its-container-activity – Lokesh Mar 03 '14 at 04:33
2 Answers
0
            
            
        Use Intent to pass data from one activity to another
Intent myIntent = new Intent(FirstActivity.java,SecondActivity.class);
myIntent.putExtra("data","**** Your data *****");
startActivity(myIntent);
If you want to pass user derfined Object from one activity to another then you have to implement Serilizable or Parcelable
Check the following links for how to use Serilizable
- 
                    but its not normal data passing from one activity to another activity. It's fragment to activity. – user3277750 Mar 03 '14 at 04:08
- 
                    Yeah you can pass data from `FragmentActivity` to normal `Activity` same way as you do in Activity to Activity – Kunu Mar 03 '14 at 04:13
- 
                    It will be more clear what you want to do if you post some of your `code' – Kunu Mar 03 '14 at 04:14
- 
                    As I said in my question as well, I want to pass my location data (or any other string for example "123" from my mapfragment to a.activity). Hope it will clear your confusion – user3277750 Mar 03 '14 at 04:25
- 
                    
- 
                    it does not matter to pass data on marker click or by another way as long as it passes data. – user3277750 Mar 03 '14 at 05:52
- 
                    allright then the answers is same via Intent no matter a fragmentActivity or activity – kevz Mar 03 '14 at 05:59
0
            
            
        use getActivity() to send data into other activity
Intent myIntent = new Intent(getActivity(),SecondActivity.class);
myIntent.putExtra("key","**** Your data *****");
getActivity().startActivity(myIntent);
 
    
    
        Nitin
        
- 258
- 2
- 8
 
     
    