1

I have developed a Java program that uses org.apache.http, and I would like to reuse most of the functionality in an Android app. I would also like to still be able to use my library in my Java program as I add functionality to it. That's why I'm looking for a way to share a single component that I could improve over time, so that I don't have to replicate my modifications each time.

I know that Android has a built-in Apache HTTP client and URLConnection, but I'm pretty sure that simply packaging my original program in a Jar with a common API won't directly work in Android, will it?

I know I'll get answers like "try it and you'll see", that's actually what I'm about to do. But trying here would cost some time, that's why I'm asking beforehand if there would be a simple way to achieve this before I go into hard translation/integration work.

Will I need for instance to create an adapter layer to really isolate the request building (with specific data) from the HTTP client? This sort of wrapper around HTTP-related stuff could delegate to Apache on the pure Java program, and to Volley (or anything else) on the Android plateform.

I would be glad if there was a simpler way...

0

1 Answer 1

1

I've made a library once a day in java then when shifting to Android I had to use the built-in HTTP of it, at the end I made 2 libraries one for java and another one for Android the main difference was the imports

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

1 Comment

Thanks for your insight, that's what I was afraid of. I'll wait a little bit to see if other people have solutions to this problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.