Developing an Android app includes a number of repetitive tasks. Like SQLite interactions or Model <=> JSON conversions or findViewById() calls and then casting.

Eventually I ended up with a number of helper classes that were copied from project to project. That’s how DroidParts started.

The vision for DroidParts is a minimalistic framework with clean API that eliminates the most common boilerplate code.

Some Code

The code below:

  1. Displays a list of Postings from EntityCursorAdapter which is backed by ORM.
  2. Injects a Button and sets OnClickListener.
  3. Fetches, caches & attaches pics in a single line of code.
  4. Serializes Postings to JSON & http POSTs the resulting JSONArray.
public class PostingListFragment extends ListFragment implements
        View.OnClickListener, AlterableContent<Select<Posting>>,
        AsyncTaskResultListener<HTTPResponse> {

    private EntityCursorAdapter<Posting> adapter;

    private DialogFactory dialogFactory;

    @InjectView(id =, click = true)
    private Button submitBtn;

    private Select<Posting> select;

    public void onActivityCreated(Bundle savedInstanceState) {
        adapter = new PostingCursorAdapter(getActivity());

    public void onClick(View v) {
        if (v == submitBtn) {

    public void setContent(Select<Posting> select) { = select;

    private void submitPostings() {
        new SubmitPostingsTask(getActivity(), this, select).execute();

    public void onAsyncTaskSuccess(HTTPResponse resp) {
        dialogFactory.showToast("Response: " + resp.body);

    public void onAsyncTaskFailure(Exception e) {


public class PostingCursorAdapter extends EntityCursorAdapter<Posting> {

    public PostingCursorAdapter(Context ctx) {
        super(ctx, Posting.class);

    private ImageFetcher imageFetcher;

    public void bindView(Context context, View view, Posting item) {
        PostingViewHolder holder = (PostingViewHolder) view.getTag();
        imageFetcher.attachImage(holder.iconView, item.iconUrl);

    // ...

public class SubmitPostingsTask extends SimpleAsyncTask<HTTPResponse> {

    private final Select<Posting> select;

    private final EntityManager<Posting> entityManager;
    private final JSONSerializer<Posting> jsonSerializer;

    private RESTClient2 restClient;

    public SubmitPostingsTask(Context ctx,
            AsyncTaskResultListener<HTTPResponse> resultListener,
            Select<Posting> select) {
        super(ctx, resultListener); = select;
        entityManager = new EntityManager<Posting>(Posting.class, ctx);
        jsonSerializer = new JSONSerializer<Posting>(Posting.class, ctx);

    protected HTTPResponse onExecute() throws Exception {
        ArrayList<Posting> list = entityManager.readAll(select);
        JSONArray arr = jsonSerializer.serializeAll(list);
        return"", arr);


TL;DR DroidParts saves a lot of keystrokes & helps write elegant code.