Android RecyclerView (Part 4) with Android Volley, JSON, PHP & MySQL - 2016

Android RecyclerView (Part 4) with Android Volley, JSON, PHP & MySQL - 2016 - Hello friends Android tutorial and tips trik, The article you are reading this time with the title Android RecyclerView (Part 4) with Android Volley, JSON, PHP & MySQL - 2016, we have prepared this article for you to read and download the information therein. hopefully fill posts article (Part, article #4, article android, article JSON, article PHP, article RecyclerView, article Tutorial, article Volley, article with, we can write this you understand. Well, happy reading.

Title : Android RecyclerView (Part 4) with Android Volley, JSON, PHP & MySQL - 2016
link : Android RecyclerView (Part 4) with Android Volley, JSON, PHP & MySQL - 2016

Baca juga


Android RecyclerView (Part 4) with Android Volley, JSON, PHP & MySQL - 2016

Hello everyone! My name is Oum Saokosal.

Today, we're going to talk about the androidRecyclerView again and in this video, I'm going to talk about how to connect data andget a data from database server and I will PHP and MySQL and to connect to the web serverand database server, we need a library and I will use [ ] And also, I will show you howto convert the data from MySQL to JSON.

Because the android cannot read the databasefrom the MySQL.

You have to convert it to JSON first.

So, it's going to be a very long video.

But I will cut it in like two or three parts.

And this is my YouTube channel and this ismy Facebook kosalgeek.

Twitter and GitHub.

And particularly, you will use one of my libraryfrom kosalgeek, GitHub here.

So, in the previous videos, I talked aboutthe process here from one, two, seven.

The most difficult part is number five.

So, I will now cover this like, how to geta data, the real data from here.

So, to connect to the network, we have someprocess.

We will connect to like a PHP server, likeApache server and then Apache will connect to the database MySQL and you will get a databack and send back to the android.

This is process is not for android itself.

You can do that in IPhone or windows phonealso.

It is the same process.

Let me talk a little bit about network connection.

There are histories for that like, beforeandroid three, you can connect to the network but after that, you're going to use anotherlibrary for AsyncTask.

You will need this to library URL connectionand Http client.

And then, the AsyncTask has the problem becauseit is asynchronous.

Only thing happens at one time.

Imagine you have a long list of maybe, images,you want to upload or download, you're going to spend a very long time to complee the atsk,the whole task.

So, Volley is another library in use by Google.

So, they usually consider it like a Volleyballbut actually it's about shooting arrows at the same, many arrows at the same time.

It's like multitasking.

At one time, you can do many things.

And one simple class of the Volley is alteringrequests.

You're going to need the request method, postand get to the server and then the server will respond back.

If there is an error, we will get the arrowback.

So, you have four perimeters or some requests.

If you this, you don't have the error.

If you have the error, you don't have this.

And then, after you get the data, the datawill be in JSON text.

You will convert to the object.

You have to have a class that have to feelexactly matching to this one.

It doesn't have to be the same but becauseI use my library and library use JSON and JSON needs your feel.

A tribute here.

The name has to be the same to this one.

Text like this.

And that IMG has to be like that and thenyou put into the ArrayList.

So, that the whole process is in the one,two, three here.

Let me go to the android but before that,maybe I want to use my channel.

This is my channel.

If you're looking for the first, second andthird one, you should go down here, upload, you will see this and this is my Facebookpage.

Please like it.

And for the code, please download from here.

If you want to continue from this lesson butif you are trying to do that from the beginning, maybe start from the first one.

So, this is the source code.

This one.

So, the previous one, run again.

So, let me run again.

It has a problem all the time now with theemulator.

Let me close it.

After I updated, it has some problems becausethat it complained that my [ ] version is lower than the Genymotion.

I'm not sure why I think this is part of thereason.

Maybe I have to pause the video a little bit.

I'm not sure why I have to fix it, maybe later.

But now I can run it.

So, in the previous video, I did data, I gotthe data, I just generate it.

So, in this video, I will show you how todo that but it's a long process.

I told you in the PowerPoint lite.

You need some of the other tool as well.

And I suggest if you want to understand theandroid Volley very deeply, maybe you should go to my channel and looking for I think androidVolley.

Here.

It's a very long process but let me assumeyou already know that because without me assuming, I will repeat my video again.

So, I'm not going to do that.

First, you need another tool.

So, we have WAMP on windows and for me, Iuse XAMPP on Mac and you need to know PHP and MySQL.

I will show you some codes and I already didit.

So, I will not write it again.

It will make the video very long.

And the JSON.

I will talk abuot how to convert the PHP databaseto the JSON.

So, first, you need this and if you don'thave that, please stop the video and go to the internet and download it.

There is a permission as well for XAMPP andWAMP.

Usually, when you, Sorry, there is some problem.

Sorry about that.

So now, we talk back about it.

So, this is the previous one and we got thedata from the internet as well.

Image here.

So, you need this and usually you will havea problem with the permission.

You have to go to Apache and some fix here.

And open Config file and down here somewhere.

Okay, like, requests are granted.

You have to put like that but I forgot whichone but usually when you have some problem like you connect from the emulator, you haveto change this to granted all require like that.

I think should be this one.

If you see like, permission denied, like that,you could change it to require all granted.

Then, you can connect from this one.

If you use the real server, you don't haveto fix that but from now, I will show you how to connect from the android to the localhost.

And the port here is eighty.

If you have another port, make sure you putanother port as well.

Let me show you.

And this is my local host.

Let's see the database, I have a database.

We can use any.

This one, he made.

This one, is good one.

Let's see the structure.

So, please create a table inside the otherwords like that.

Customer.

You want to follow along my video for thedatabase name is customer and inside that is TBL product and this one the primary keyand auto implement and the name, quantity, price.

You need their files.

He made URL and user ID.

Then, you should add some data like that andthis one I think is in customer folder.

Here, but inside the customer, I have IMG.

This is my image.

Image it is the real one.

So, you should name like that.

If you have space, it's fine but it's goingto have some problem.

When you read that, you have to know how todeal with the space.

But at first, I suggest you put a name likethat and make sure you open the extension if you are on windows, you should open inlike, somewhere in Windows explorer the option which show the extension because png, jpegand jpg is different.

So you make sure that the real URL is exactlythe same.

And the database is from the image and fromthe folder IMG.

And this is the data and then, where is it? This one.

And you need only two.

Why? Just to read the data from the first connectionand you are free to use any brown in the text data but if you are using note, not let plus,plus.

You're going to have one problem.

It's about the converting.

Usually in converting, you encounter two problemshere and you will encounter that as well but it's for permission forbidden from the XAMPP.

You have to open that in particular file here.

And another one is the JSON for my Malformformat.

This because the text, the PHP text is notUTF eight.

So, you have to convert it to a UTF eight.

And if you are using [ ] normally, you willhave this problem but I suggest you to convert it or maybe just simply use, like brackets.

I don't have any problem like that.

Okay, and the server is local host.

The username is root and password, no password.

And the customer is the database name.

And I use my MySQL like that and then I haveanother one.

What is it, the product? Yeah, it's the product.

So, I included.

I just selected like, all the data.

The ID name, quantity, price, like that.

From TBL product, order by the latest itemat the first scroll.

If you don't do that, like always show thefirst item the number zero but the newest, it's at the bottom.

It's not good.

And here, you get the data and while you arelooping, you can send to an array.

You declare an array and the text, I'm sorry.

And the object, in the array is like the data,PID, name, quantity like that.

You going to convert it after the while.

You convert it to the JSON encode.

So, all the text will convert to the JSON.

So, PHP have this beautiful method.

JSON encode is going to encode any array tothe JSON.

So, let's see.

It is inside.

Customer.

Yes.

So, all the text here like the data here,JSON open but one thing I have to know that if your data has a single quote, a doublequote or a slash or something like that.

You have to convert it because you're goingto have a conflict with it.

And if you like imagine you have like, let'ssay this and then the data like ID will be name and then you have another like that.

So, what is the problem? So, you have to change it and I'm not goingto teach you that but it's very easy like HMTL, special characters, PHP, like that.

And maybe just decode.

Then you going to be called any special character.

These two things happen all the time.

So, be aware of that.

Now, you have the JSON.

I told you already how to convert it in myslides.

From the PHP to the JSON, already done.

And I will upload the source code in the databaseas well.

And now it's time to convert the JSON to theArrayList object.

So, we need to have the Volley and then, youneed Volley, So, let's call android Volley.

So, in this video, I think I will just canopen maybe setup the Volley.

It will be fine like eighteen minutes already.

So, to set it up, you go to android Volleyfrom that and you see some document from android and that second one is the library.

And you go to setting up request queue.

So, you can add any request.

It's like big strings, JSON Array, JSON object.

There are many things.

This is the request.

And first, maybe it's a good idea to add a,just add, where is it? This one.

You go to gradle and here, now, it's goodto go.

So, you want to test it.

Maybe, because you going to get a data before,you going to use the RecyclerView here.

So, the data should be around here.

Maybe, let's use this because we going touse the generate dummy.

But maybe you going to make another, let'ssay ArrayList again but this time, we don't have the, we don't need the item because itemis another thing.

Because in our database, let's see our databasehere.

It's about product.

So, we have to make another class for thisone.

But it's going to take some time.

Let me just make it another video.

Let me test it if the body is already herenow.

Just call, Volley.

It's already here and bring request.

Yes.

Okay.

One more thing for android Volley.

It's like, remember when you have the image.

Imagine you have a wall.

You cannot have two commanders.

You can only have on commander or maybe oneking.

One king will command, give a command to thewhole team because the king or commander can have good strategy.

Maybe a horse will go first or knight or soldieron foot will go after.

And the Arrow shoot, if maybe like at thesame time like, the horse will go at some point, and then certainly another commandercall the anchor, the archer, the shooter, shoot to here and maybe go after horse afterknights.

So, we cannot do that.

That's why android Volley use this partnercalled Singleton.

Singleton is like a mechanism to make surethat has only one object, one command.

One commander in the field.

So, even though the question here can be createlike that but I, I'm not going to suggest you to do that and even android suggest youto use this pattern.

So, you will need this code.

So just copy the code, like this and let'sMySingleton and the name directory must be exactly the same with the name of this classbecause the Java class.

And the Java class name has to be the same.

And half open.

And you have one error here.

Control Space and you can choose the report.

It was the report for the older version.

And make sure you have the android money viathe internet connection inside.

So, now you are good to go for the MySingleton.

So, MySingleton like this and this.

Let's go.

This is the checking out the Android Volley.

And you going to have a lot of things like,how to convert the JSON to the Arraylist and then get the data and then put into the, likethat, RecyclerView.

It's going to take more time.

So I will have to end this time and I willsee you in the next video.



Thus Article Android RecyclerView (Part 4) with Android Volley, JSON, PHP & MySQL - 2016

That article Android RecyclerView (Part 4) with Android Volley, JSON, PHP & MySQL - 2016 This time, hopefully we can give you all of the benefits. Well, I'll see you in another article post.

You now read the article Android RecyclerView (Part 4) with Android Volley, JSON, PHP & MySQL - 2016 the link address http://svedda79.blogspot.com/2016/08/android-recyclerview-part-4-with.html

0 Response to "Android RecyclerView (Part 4) with Android Volley, JSON, PHP & MySQL - 2016"

Post a Comment