Conversation
|
|
||
| public void onClick(View v) | ||
| { | ||
| switch(v.getId()) |
There was a problem hiding this comment.
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); |
| dialog.dismiss(); | ||
| Intent intent = new Intent(Intent.ACTION_GET_CONTENT); | ||
| intent.setType("image/*"); | ||
| startActivityForResult(intent, 1); } |
There was a problem hiding this comment.
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