You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by Dan Haywood <da...@haywood-associates.co.uk> on 2013/07/08 09:06:46 UTC

Fwd: Android Viewer

archiving this offline chat between Maurizio and Dimuthu, 7th July

---------- Forwarded message ----------

*Dimuthu:* Hi Maurizio
*Dimuthu:* Are you busy now?
*Maurizio:* Hi, no I'm available
*Dimuthu:*  Thank you for your feedback
*Dimuthu:* The error you mentioned may be occurred because of not
connecting to the server
*Dimuthu*: Did you start the server before you run the application?
*Maurizio:* Yes, of course, I faced two problems 1. Credential not set 2.
you catch the exeption for asUri but not the IOException ... so when the
exception occours you don't know why
*Dimuthu:*  Mmm can you please explain how to reproduce this error? Then I
can look into it
*Maurizio:* However I have a design problem of HomepageRepresentation and
HomepageModel classes
*Maurizio:* In HomepageRepresentation class there are only list of links
which is the same copy of details of RESTful interface
*Dimuthu:*However what I need to show in homepage is the set of services as
a list
*Dimuthu:*To do that I have to go to services link and fetch each service
and read its title.
*Dimuthu:*That is what I expected from HomePageModel class
*Maurizio:* Well, usually the home page has a single link to services
*Maurizio:* However I think the  model should follow Dan suggestion
*Maurizio:* Your model has static methods, where you perform Synchronous
calls to the domain service link. I don't think it is the right place where
to do it
*Dimuthu:* For now I would leave package uimodel and try to directly call
representation classes to create ui
*Dimuthu:* However I don't understand the scope of usage of AsyncTasks
*Dimuthu:* I mean where to use it and not to
*Maurizio:* Basically every time you perform a unpredictable time consuming
task, like an Http Call
*Maurizio:* there is a lot of documentation on this topic
*Maurizio:* it is the equivalent of Ajax
*Dimuthu:*  Ok. I got the idea
*Maurizio:*
http://developer.android.com/guide/components/processes-and-threads.html
*Maurizio:* Check out *Using AsyncTask*
*Maurizio:* methods like asUriStr should be outside of AsyncTask
*Dimuthu:* Ah Thanx. I'll take a look in to that
*Maurizio:* URL computation is not a task to run in background, it makes no
sense
*Dimuthu:* Yes yes.
*Maurizio:* retrieve the data from the server, for example with a mobile
network, makes sense because you don't know how the data are received
*Maurizio:* for example with a 3G network maybe you receive the response in
chunks
here you need a Task waiting in background
*Dimuthu:* Yeah. I understood. I will do the necessary changes and commit
again. Please let me know whether I'm doing right.
*Maurizio:* sure :)
*Maurizio:* please fix the Singleton, having a singleton pointing to
another one is a source of memory leaks
*Dimuthu:* You mean in HTTPhelper class?
*Maurizio:* Yep, in your ROClient have a reference to the HttpHelper the
ROClient class is already a sigleton, so why you need another one?
*Dimuthu:* Yes yes. I just missed that point I'll fix it
*Maurizio:*  you can declare a final Httpclient as member and create the
object in the Singleton constructor
*Dimuthu:*   Thanx for the help
*Maurizio:*  you are welcome

Re: Fwd: Android Viewer

Posted by Bhargav Golla <bh...@gmail.com>.
DImuthu: You can use this library[1] to make async http requests. It has
couple of other good features too. It is licensed under Apache 2.0 license.
So you can use it.

[1] http://loopj.com/android-async-http/

Bhargav Golla
On Jul 8, 2013 12:38 PM, "Dan Haywood" <da...@haywood-associates.co.uk> wrote:

> archiving this offline chat between Maurizio and Dimuthu, 7th July
>
> ---------- Forwarded message ----------
>
> *Dimuthu:* Hi Maurizio
> *Dimuthu:* Are you busy now?
> *Maurizio:* Hi, no I'm available
> *Dimuthu:*  Thank you for your feedback
> *Dimuthu:* The error you mentioned may be occurred because of not
> connecting to the server
> *Dimuthu*: Did you start the server before you run the application?
> *Maurizio:* Yes, of course, I faced two problems 1. Credential not set 2.
> you catch the exeption for asUri but not the IOException ... so when the
> exception occours you don't know why
> *Dimuthu:*  Mmm can you please explain how to reproduce this error? Then I
> can look into it
> *Maurizio:* However I have a design problem of HomepageRepresentation and
> HomepageModel classes
> *Maurizio:* In HomepageRepresentation class there are only list of links
> which is the same copy of details of RESTful interface
> *Dimuthu:*However what I need to show in homepage is the set of services as
> a list
> *Dimuthu:*To do that I have to go to services link and fetch each service
> and read its title.
> *Dimuthu:*That is what I expected from HomePageModel class
> *Maurizio:* Well, usually the home page has a single link to services
> *Maurizio:* However I think the  model should follow Dan suggestion
> *Maurizio:* Your model has static methods, where you perform Synchronous
> calls to the domain service link. I don't think it is the right place where
> to do it
> *Dimuthu:* For now I would leave package uimodel and try to directly call
> representation classes to create ui
> *Dimuthu:* However I don't understand the scope of usage of AsyncTasks
> *Dimuthu:* I mean where to use it and not to
> *Maurizio:* Basically every time you perform a unpredictable time consuming
> task, like an Http Call
> *Maurizio:* there is a lot of documentation on this topic
> *Maurizio:* it is the equivalent of Ajax
> *Dimuthu:*  Ok. I got the idea
> *Maurizio:*
> http://developer.android.com/guide/components/processes-and-threads.html
> *Maurizio:* Check out *Using AsyncTask*
> *Maurizio:* methods like asUriStr should be outside of AsyncTask
> *Dimuthu:* Ah Thanx. I'll take a look in to that
> *Maurizio:* URL computation is not a task to run in background, it makes no
> sense
> *Dimuthu:* Yes yes.
> *Maurizio:* retrieve the data from the server, for example with a mobile
> network, makes sense because you don't know how the data are received
> *Maurizio:* for example with a 3G network maybe you receive the response in
> chunks
> here you need a Task waiting in background
> *Dimuthu:* Yeah. I understood. I will do the necessary changes and commit
> again. Please let me know whether I'm doing right.
> *Maurizio:* sure :)
> *Maurizio:* please fix the Singleton, having a singleton pointing to
> another one is a source of memory leaks
> *Dimuthu:* You mean in HTTPhelper class?
> *Maurizio:* Yep, in your ROClient have a reference to the HttpHelper the
> ROClient class is already a sigleton, so why you need another one?
> *Dimuthu:* Yes yes. I just missed that point I'll fix it
> *Maurizio:*  you can declare a final Httpclient as member and create the
> object in the Singleton constructor
> *Dimuthu:*   Thanx for the help
> *Maurizio:*  you are welcome
>