Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - [TUTORIAL] How to base64 encode decode

[TUTORIAL] How to base64 encode decode

Basic Tutorials concerning: GUI, Views, Activites, XML, Layouts, Intents, ...

[TUTORIAL] How to base64 encode decode

Postby AndroidCodeMonkey » Mon Mar 08, 2010 7:16 am

The official documentation states that base64 encode and decode in Android is in the Android.util package. But when you go to use it you will find it's not there!
Image

After much searching, I confirmation Android left base64 encode and decode out of the Android.util package. So what to do? Don't worry, Robert W. Harder has but together a very fast Base64 encoding and decoding class you can include in your project. Here is how to add base64 encode and decode to your project.

Step 1. Visit Robert's website http://iharder.sourceforge.net/current/index.html and download the class file.
Image

Step 2. The zip file you downloaded in step 1 includes the base64 class and a folder with examples and documentation.

Image

Step 3. Copy the Base64.java class file into your project. Copy into your appropriate "src" folder.
Image

Step 4. Refresh your project so the new file is included.
Image

Step 5.When the Base64.java file is included in your project, you will get the following error "The declared package does not match the expected package". Fix this by opening the class file and adding a package declaration that matches your project.
Image

Step 6. Done. Your ready to base64 encode and decode.
Image
Attachments
Base64Test.zip
Complete Eclipse sample project
(92.67 KiB) Downloaded 617 times
User avatar
AndroidCodeMonkey
Freshman
Freshman
 
Posts: 4
Joined: Sun Jan 24, 2010 7:15 am

Top

Return to Novice Tutorials

Who is online

Users browsing this forum: No registered users and 6 guests