1

Hi I am new in android development, my question is how to obtain data from Mysql(questions) PHP(server) to the tablet, i know that with web service but how, and display automatic in the activity (texview) questions for example 5 questions for each screen and other 5 for the next screen automatically.

Any ideas, or helpful site, examples where i could find this information. sorry for my bad English, I hope you understand, and i am beginning in this development of apps. thank you for your answers.

ThinkingStiff
  • 64,767
  • 30
  • 146
  • 239
  • Welcome to SO. Questions on SO are programming related. Please refer to http://stackoverflow.com/faq – Orlymee Nov 10 '12 at 02:33

1 Answers1

2

You will need to make a HTTP request, refer to links below on how to do this.

Make an HTTP request with android

Send data from android to server via JSON

On the php server side you will need to set it up to get the questions from the database and then using the information in the links above send it back to the tablet.

Then you will need to take the data from the http request and update the textviews to the questions. you can do this with :

String stg = yourHTTPData;
TextView tv = (TextView) getViewById(R.id.tv);
tv.setText(stg); 

The textViews can be made in the java code or in an android XML file. I recommend using two different activities for the first and second screen.

Here is a good youtube playlist that helped me start when learning, it is in english but you should pick up enough to learn how to do everything :) https://www.youtube.com/course?list=ECB03EA9545DD188C3&feature=plcp

Hope this helps a little. I have made somthing similar at home (I am away from home at the moment) so if you want more code snippets then ask and I will put them up tomorrow :)

Community
  • 1
  • 1
Nick
  • 2,593
  • 3
  • 30
  • 59