0

I am new to android and currently developing an app.. Just wanted to know what exactly does an http entity does? Also please tell me, why it gives me an error on the following code:

HttpClient cl=new HttpClient // Cannot instantiate HttpClient

but this works..

HttpClient cl=new DefaultHttpClient

If you have any resources related to httpclient and webservices please tell!

Thanks a lot for your help!

1 Answer 1

1

HttpClient is an abstract interface so it can't be instantiated. DefaultHttpClient implements HttpClient (through the AbstractHttpClient interface) so you can instantiate that

You would probably want to read up on abstract classes and interfaces and become familiar with them.

Sign up to request clarification or add additional context in comments.

2 Comments

thanks a lot! I knw abstract iterfaces and classes cnt be instantiated but didnt know that httpclient is an abstract interface! Thanks for ur help.. Please suggest any resources for the same!
You can CTRL-Click on the identifier name in Eclipse or IntelliJ and this will bring you to the definition, in the case of HttpClient you would see "public interface HttpClient" and in the case of AbstractHttpClient you would see "public abstract class AbstractHttpClient implements org.apache.http.client.HttpClient" which would give you a clue - apart from that I can't really recommend any resources.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.