I can\'t get data from MySQL database for graphics. I found an example code for create graph but I want to put x axis data and y axis data from database
My example c
Yeah, this just isn't going to work. Activity.onCreate is not main(). You can't just put your application there.
I'm sure this isn't what you want to hear, by you really need to go all the way back to the drawing board. You are going to want to put the code that requests the JSON object into a Service.
The code that does the actual graphing looks pretty good. You will need to set it up so that when the Service succeeds in retrieving the JSON, and then parsing it, it notifies the Activity that there is something to graph.
Step back from the code and brush up on Android architecture for a couple days. It isn't hard, but it is different.