Reputation: 45
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
Reputation:
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.
You will most likely need to have a PictureProcessActivity
to process the pictures in the manner you want.
The PictureUploadActivity
is not really necessary. You could use a Progress Dialog or Progress Bar to show the progress in the PictureProcessActivity
.
In my opinion you need at least two activities:
MainActivity
/ PictureCaptureActivity
to take a photoPictureProcessActivity
to process the photoYou 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
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:
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:
Goodluck.
Upvotes: 1
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