Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts

Monday, April 16, 2012

static classes(when dealing with adapters)

you might normally come across when you call the adapter from another class, they ask the class to be static

eg: private TescoJsonParser TJP= new TescoJsonParser();
String sessionkey= TescoJsonParser.login("youremail@gmail.com","password");
ProductDetails parsedResult=TescoJsonParser.getProductByBarcode(contents,sessionkey );
products.add(parsedResult);
productLists.setAdapter(new ProductViewAdapter(this,products));

I cannot use TJP.login(....,...);
here is why:
http://www.javaworld.com/javaworld/javaqa/1999-08/01-qa-static2.html