This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// sender | |
public class LoginActivity extends Activity { | |
void displayHome() { | |
startActivity(HomeActivity.newIntent(this, user)); | |
} | |
} | |
// receiver | |
public class HomeActivity extends Activity { | |
private static final String KEY_USER = "KEY_USER"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Constants { | |
public static final String KEY_USER = "KEY_USER"; | |
} | |
// sends the data | |
public class LoginActivity extends Activity { | |
void displayHome() { | |
Intent intent = new Intent(this, HomeActivity.class); | |
intent.putExtra(Constants.KEY_USER, user); | |
startActivity(intent); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// sends the data | |
public class LoginActivity extends Activity { | |
void displayHome() { | |
Intent intent = new Intent(this, HomeActivity.class); | |
intent.putExtra(HomeActivity.KEY_USER, user); | |
startActivity(intent); | |
} | |
} | |
// gets the data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// sends the data | |
public class LoginActivity extends Activity { | |
private static final String KEY_USER = "KEY_USER"; | |
void displayHome() { | |
Intent intent = new Intent(this, HomeActivity.class); | |
intent.putExtra(KEY_USER, user); | |
startActivity(intent); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyFragment extends Fragment { | |
private void init() { | |
for (View view : views) { | |
view.setBackgroundColor(Color.BLACK); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ShareAndImageActivity extends Activity { | |
ImageHelper imageHelper; | |
ShareHelper shareHelper; | |
@Override public void onCreate(Bundle bundle){ | |
... | |
imageHelper.onCreate(bundle); | |
shareHelper.onCreate(bundle); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AccountActivity extends Activity { | |
ImageHelper imageHelper; | |
@Override public void onCreate(Bundle bundle){ | |
... | |
imageHelper.onCreate(bundle); | |
} | |
@Override public void onDestroy() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ImageHelper { | |
public void onCreate(Bundle bundle) { | |
// init | |
} | |
public void onDestroy() { | |
// release allocations | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ShareActivity extends Activity { | |
@Override public void onCreate(Bundle bundle){ | |
// init | |
} | |
@Override public void onDestroy() { | |
// release memory | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ProductActivity extends ImageActivity { | |
@Override public void onCreate(Bundle bundle){ | |
// init | |
} | |
public void onAvatarClicked() { | |
showGalery(); | |
} | |