-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iCommit #1
base: master
Are you sure you want to change the base?
iCommit #1
Conversation
|
||
public void onClick(View v) | ||
{ | ||
switch(v.getId()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For each case in the switch statement, instead of having long blocks of code, you could put functions instead. For example, you could have createNewEventClicked(), imageClicked(), etc. This makes the switch easier to read and modularizes the code. Try to do this in all cases where there are switch statements.
String desc = newDescText.getText().toString(); | ||
String host = mAuth.getCurrentUser().getEmail(); | ||
|
||
FirebaseUtils.writeEventToDB(mDatabase, riversRef, eventimageuri, key, name, date, desc, host, mAuth); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good use of utils
dialog.dismiss(); | ||
Intent intent = new Intent(Intent.ACTION_GET_CONTENT); | ||
intent.setType("image/*"); | ||
startActivityForResult(intent, 1); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of doing startActivityForResult(intent, 1), put 1 in a public static final variable. For example, you could do:
public static final int CHOOSE_PHOTO_REQUEST = 1. That way, in onActivityResult in the bottom, when you check whether requestCode == 1, you know what it is actually checking for (instead you would check requestCode == CHOOSE_PHOTO_REQUEST).
pls