Decompress String in Android which Is Compressed With PHP

Most of the people are searching for Android String Compression and Android String Decompression. This Article is all about data decompression in Android. Decompress String in Android – People who are searching for gzip decompression for data that compressed with PHP gzcompress(), are not aware of the thing that PHP is using zlib instead of Android’s gzip. To decompress string compressed with gzcompress() we need to use Infliater in android, not gzipinputstream. I’m sharing here project that will decompress received string compressed by php gzcomprss().

android-string-decompression

Above Picture is showing Code snippet. Sample code are mentioned below:

Create a PHP script:

Create any test project having an index file and copy the above-mentioned code to that index file. Above script is compressing “Hi Readers, I\’m Dipendra Sharma, here with you to decompress string with gzcompress()” string using gzcompres(). Upload this script to the server by named index.php & Now create an Android project with and activity having TextView or follow steps:

Create MainActivity.java : (Decompress String In android)

Replace server Address with your Host address where you have saved your PHP script.
Now go to resource folder and create activitymain.xml :

 

and run your application. you will get your decompressed string that you had compressed in PHP script. All the best !!

If you are working with Android User Profile screen like WhatsApp. Please visit the link: Collapsing toolbar like whatsapp

I’m Dipendra, software developer, and designer who has written code in many of the language known to mankind.Passionate about Technology. In my free time, I love to write articles and build the code.

Leave a reply:

Your email address will not be published.

Site Footer