Skip to main content

Posts

Showing posts from 2015

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            ...

Calling Method

public   async   Task < string >   Get_Method   ( string   name )          {                           if   ( name   ==   " News " )   {                  request   =   ( HttpWebRequest ) HttpWebRequest . Create   ( new   Uri   ( BaseUrl   +   Base_Blog )) ;                   // request   =   ( HttpWebRequest ) HttpWebRequest . Create   ( new   Uri   ( parameter ) ) ;              }   else   {                ...

Create Core Project in Xamarin

In Xamarin For Database , Web services calling for Common for Android, iOS, Windows . Step to Create that Core : 1) Right click on Project  2) Click Add 3) Add New Project 4) At Left hand side "Other" option available and at there ".Net" feature available. 5) There are many option One of name "Shared Project" And your Core part created. so In that Project create all stuff like all query, Database creation, Webservices Calling.

Open Webpage in Default Browser

Open webpage to default browser you need to write this code in Xamarin Andorid :) Code :  var   uri   =  Android . Net . Uri . Parse   ( " http : / / www . dharmik . me " ) ; var   intent   =   new   Intent   ( Intent . ActionView ,   uri ) ;      StartActivity   ( intent ) ;

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/  

Open Map in Default Map application in Xamarin

 This code open map in android mobile application with Intent it will open map application which already exist in your mobile.  Code : var   geoUri   =  Android . Net . Uri . Parse   ( " geo :24 , - 45 . 12 " ) ; var   mapIntent   =   new   Intent   ( Intent . ActionView ,   geoUri ) ;     StartActivity   ( mapIntent ) ;     For More information visit this URL : https://developer.xamarin.com/recipes/android/fundamentals/intent/launch_the_map_application/   Alternative Code :   var   navigationIntent   =   new   Intent ( Intent . ActionView ,  Android . Net . Uri . Parse ( String . Format ( CultureInfo . InvariantCulture ,                            " http : / / maps . google . com / maps ? daddr = { 0 } , { 1 } ...

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"

Open New Activity in Xamarin Android

Second step to learn xamarin : There are multiple ways to open new activity . Here , i will show you two ways to open activity in xamarin Code : 1) StartActivity ( typeof ( SecondActivity )) ; 2) var   activity2   =   new   Intent   ( this ,   typeof ( SecondActivity )) ;       StartActivity   ( activity2 ) ; "SecondActivity" : Name of Activity which you want to open  

"Timeouts & Waiting" function in Android Xamarin

Hello, I am here to start some of Good platform which name Xamarin , Its a Cross-Platform and its basically written in C#. First Blog for Set Timeout function  : Code : using  System . Threading ; System . Threading . Tasks . Task . Factory . StartNew (()   = >   {                 Thread . Sleep ( 5000 ) ;   //   delay   execution   for   500 0 ms }) ;