Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Android
I am new in android. I am using web service in android and i want to display data in gridview.plz help me.
Posted 4-Apr-11 1:10am
drenu483
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

have you taken a look at this?
 
Android GridView[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

First create the Class with necessary properties which the web service gives you.
 
Ex. if web service giving you dataset of employee the create class like below with getter and setter methods.
 

public class Employee {
 
	private String EmployeeID;
	private String Name;
	private String Genre;
	private String Email;
	
 
	public String getEmployeeID() {
		return EmployeeID;
	}
 
	public void setEmployeeID(String EmployeeID) {
		this.EmployeeID = EmployeeID;
	}
 
	
 
	public String getEmail() {
		return Email;
	}
 
	public void setEmail(String Email) {
		this.Email = Email;
	}
 
	
	public String getName() {
		return Name;
	}
 
	public void setName(String Name) {
		this.Name = Name;
	}
 
}
 

Then make a Arraylist of "Employee" class like
 
ArrayList<employee> emplist=new ArrayList<employee>();</employee></employee>
 
Extract data from your web service responce to new object of "Employee" and then add that object to ArrayList
 
Then make the BaseAdapter and bind it to gridview like
 
MyGrid.setAdapter("...");
  Permalink  
Comments
AArjun24 at 5-Apr-12 0:42am
   
I can create a class with getter and setter method.but i dont understand how can i
Extract data from my web service responce to new object my Class.plz give me steps to extract data into my class and how can i bind it to gridview
beniv at 22-Oct-13 4:37am
   
did you resolve this i have the same problem

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,107
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,382


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 25 Nov 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100