Skip to main content

Pass Data From One Activity to Other Activity in Xamarin

"I am not professional Blogger , i am here to help at some level to develop small application in Xamarin andorid for fresher"

Pass data from One Activity to Other Activity

Code :

FirstActivity : 
var secondActivity = new Intent (this, typeof(SecondActivity));
    secondActivity.PutExtra ("PassData", "Data");
    StartActivity (secondActivity);


Key Name : "PassData"
Value Pair: "Data"

 On other end it means in SecondActivity

SecondActivity : 

string  text ;
text = Intent.GetStringExtra ("PassData") ?? "Data not available";  

If PassData is null than value of Text is "Data not available"
 But here in Output : text = "Data"

Comments

Popular posts from this blog

Lottie Animations in Xamarin.iOS

Hello, Today I will give you some of detail of and How to setup Lottie animation in Xamarin iOS. Lottie is a library created by Airbnb , It will provide a good animation in Android as well as iOS in Xamarin. I want to Specially thank to Martijn van Dijk for this awesome library is available make available in Xamarin. Question) Why I need to write this Blog :   Answer) I saw people were frustrated because Lottie was not working for them, with this post I will try to explain step by step how to make it work. Okay, Guys Lets start it. Step by Step we will start and apply Lottie Animation in Xamarin.iOS. In 4 Steps we are able to steup Lottie Animation in Xamarin.iOS   1) Install Lottie Package in Xamarin.iOS project : 2) Write code to play Animation in Controller file : 3) Place that json file in Resources foler and main point is check its build action is bundle Resources : 4) Compile your iOS project :   Feel free to comment if you...

Launch Phone Dialer in Xamarin

If you want to dial direct phone via in your application in Xamarin Android please use this code , This code is same as Andorid native code. Code:   var   uri   =  Android . Net . Uri . Parse ( " tel : 9999999999 " ) ; var   callIntent   =   new   Intent   ( Intent . ActionDial , uri ) ;     StartActivity ( callIntent ) ; For More detail prefer this URL :  https://developer.xamarin.com/recipes/android/fundamentals/intent/launch_the_phone_dialer/  

Download Image in LOCAL

  Code for Download Images in Android . Just path URL of Image and it will download and store in Mobile Phone. Code :                var url   =   new   Uri ( " https : / / dl . dropboxusercontent . com / u / 72783403 / dharmik . jpg " ) ;              var   webClient   =   new   WebClient () ;              webClient . DownloadDataAsync ( url ) ;              webClient . DownloadDataCompleted   +=   ( sender ,   e )   = >   {                  var   bytes   =   e . Result ;   //   get   Data   downloaded            ...