Saturday, April 28, 2012

Android - Share Menu Feature

Intent intent = new Intent(android.content.Intent.ACTION_SEND);
intent.setType(“text/plain”);
intent.putExtra(android.content.Intent.EXTRA_TEXT, “Your Link”);
intent.putExtra(android.content.Intent.EXTRA_SUBJECT, “Some extra text if you want it”);
startActivity(Intent.createChooser(intent, “Share via”));

Thursday, April 26, 2012

C# - Decoding String From Base64


static public string DecodeFrom64(string encodedData)
{
   byte[] encodedDataAsBytes = System.Convert.FromBase64String(encodedData);
   string returnValue = System.Text.ASCIIEncoding.ASCII.GetString(encodedDataAsBytes);
   return returnValue;
}

C# - Encoding Strings to Base64


static public string EncodeTo64(string toEncode)
{
      byte[] toEncodeAsBytes = System.Text.ASCIIEncoding.ASCII.GetBytes(toEncode);
      string returnValue = System.Convert.ToBase64String(toEncodeAsBytes);
      return returnValue;
}