punctweb
punctweb

Reputation: 45

Android app - logic / principles

Hello guys (and girls),

I need your help in the matter of how to structure things in an Android app that I'm developing.

So far I have:

Now, my question is: how should I organize things in my app logic so that everything will be clear and easy to manage in the future, for the upcoming versions?

I'm thinking like this but I'm not sure if it is the right way:

Or should I include all these functionality in my MainActivity somehow? Or... ?

Thank you in advance for your guidelines!

Upvotes: 1

Views: 491

Answers (3)

user2668226
user2668226

Reputation:

PictureCaptureActivity

Do you want to have a custom interface for taking pictures with the camera, or use an existing application on the phone?

Yes - You will need a PictureCaptureActivity and will have to implement the camera functionality yourself.

No - You can use an Intent to get the user to take a picture using another application and return it to you.

Either way, you will need to look at the Camera documentation.


PictureProcessActivity

You will most likely need to have a PictureProcessActivity to process the pictures in the manner you want.


PictureUploadActivity

The PictureUploadActivity is not really necessary. You could use a Progress Dialog or Progress Bar to show the progress in the PictureProcessActivity.


MainActivity

In my opinion you need at least two activities:

  1. MainActivity / PictureCaptureActivity to take a photo
  2. PictureProcessActivity to process the photo

You could fit it all into one activity by hiding and showing icons in the Action Bar, but I'd rather not because the Activity Documentation states:

An activity is a single, focused thing that the user can do.


Disclaimer: There is no 100% correct way to do this.

Upvotes: 1

Royi Benyossef
Royi Benyossef

Reputation: 759

Before i start referring you to well written documentation and examples i have one main point i would like to emphasis and convey.

You are referring to Activities where modern Android applications are compartmentalized by Fragments (not that modern, almost 3 years) and the point of that being that the same application can work by utilizing almost 100% of the code on all Android* devices and form factors (mobile, tablet, TV, wear, auto etc.).

Now lets talk business, the best place to start reading on regarding Android is Google:

  1. Design/patterns/application structure - from the android.developers.com documentation site.
  2. Application quality checklist - created by Google following hundreds of case studies and a meticulously planned UX test.
  3. Design guidelines - updated just 2 days ago (16.4.15).
  4. IOSched - Google's display window for Android code where they show how they think an Application should look, feel and behave.

After that i would love to link you to a code lab i co-wrote with a couple of friends and a few blog posts i have written as a follow-up:

  1. AndConLab
  2. My tech blog on Android

Goodluck.

Upvotes: 1

ac0de
ac0de

Reputation: 260

I've found this to be very helpful when it comes to code keeping: https://google-styleguide.googlecode.com/svn/trunk/javaguide.html

The one thing I can't stress enough: comment your code

Upvotes: 0

Related Questions