2

I'm an android beginner, and I'm trying to find a way to retrieve data from a mysql database into a ListView, but in a Fragment instead of in an Activity. Is that even possible? Can someone give me some advises??

gaiaayan
  • 23
  • 2
  • 6
  • If you are an android beginner i recommend the Udacity android beginner course. https://www.udacity.com/course/ud853 it's free and awsome, don't expect it to be easy though – dangalg Feb 05 '15 at 06:02

2 Answers2

0

Yes it is possible. you can create a ListView in the frgamentLayout and use that listview in the fragment by using findViewById.

Then you can create a function which returns all the data from the mysql as a List and you can set that list data to the LsiyView by using an adapter.

I have already tried it once and it worked fine.

RajSharma
  • 1,941
  • 3
  • 21
  • 34
0

After a looooong search, finally I've found a solution

http://codeoncloud.blogspot.com.es/2013/07/android-mysql-php-json-tutorial.html

I used this code in my fragment, and it worked!!!!

gaiaayan
  • 23
  • 2
  • 6