Android S7E3 : PHP MySQL - Multipart Upload and Download Images and Text - GridView

Описание к видео Android S7E3 : PHP MySQL - Multipart Upload and Download Images and Text - GridView

SOURCE CODE REFERENCE : http://camposha.info/android-examples...

This is an advanced tutorial that has been requested by alot of people and we want to put together in a very easy manner.

In this tutorial we want to see how to first upload images and text to MySQL database, the retrieve them and show them in a GridView. This is an android tutorial and our programming language is Java. The user will type name, description and choose an image from explorer using a Choose Dialog at runtime.

Then he clicks a button to send them to php mysql datatabase. As we upload we will show a progressbar. There is a button that when the user clicks a new activity is opened and data is automatically fetched from mysql database. The data is rendered in a custom gridview as images and text inside a cardview.

MySQL is an open-source relational database management system.

PHP is a popular general-purpose scripting language that is especially suited to web development.

Fast, flexible and pragmatic, PHP powers everything from your blog to the most popular websites in the world.

We will be using Fast Android Networking library as we promised so we add it's implementation statement as a dependency.

Fast Android Networking is an open source android HTTP library built by Amit Shekhariitbhu.

It's been growing in popularity very fast because it's not only fast but is also user friendly. Moreover it supports advanced capabilities and documentation is great.

hrough this library we can make a HTTP GET, HTTP POST, upload data to server, download data from server etc.

In this example we will see how to perform a multi-part upload of images to server. We also send associated text that will be saved in MySQL database.

We also see how to make a HTTP GET request and download the uploaded data from mysql to our gridview.

Our GridView will comprise CardViews with images and text fetched from MySQL database. So we need to add the CardView support library.

We will use Picasso ImageLoader to download our images from our server based on the retrieved URLs. Picasso will also cache these images and show placeholder images.

We are testing our app using an emulator. To do so also you need to keep several things in place. First the emulator is like a seperate computer in your machine. If you can access you server via localhost or 127.0.0.1 in you laptop/desktop, you cannot do the same in the emulator.

This because localhost address is used internally be the emulator. So normally people use 10.0.2.2 instead of localhost. This works in majority of emulators like the android emulator or bluestacks.

If you are using Genymotion, then use 10.0.3.2 if the above doesn't work.

I personally use Nox Player, which is fast enough for my slow and overworked machine. However, the above all don't work with Nox Player.

So in that case I use the IP Address of my machine. To obtain the IP Address you type ipconfig/all in the Command Prompt, then find the IPv4. It is normally something like this : 192.168.12.2.

For more info check the link we have provided above.

Комментарии

Информация по комментариям в разработке