package com.etiennelawlor.loop.activities; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.app.AppCompatActivity; import android.view.MenuItem; import com.etiennelawlor.loop.R; import com.etiennelawlor.loop.fragments.VideoCommentsFragment; import butterknife.ButterKnife; /** * Created by etiennelawlor on 5/23/15. */ public class VideoCommentsActivity extends AppCompatActivity { // region Lifecycle Methods @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_video_comments); ButterKnife.bind(this); Fragment fragment = getSupportFragmentManager().findFragmentById(android.R.id.content); if(fragment == null){ fragment = VideoCommentsFragment.newInstance(getIntent().getExtras()); getSupportFragmentManager() .beginTransaction() .replace(android.R.id.content, fragment, "") .commit(); } else { getSupportFragmentManager() .beginTransaction() .attach(fragment) .commit(); } } @Override protected void onResume() { super.onResume(); } // endregion @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { // Respond to the action bar's Up/Home button case android.R.id.home: supportFinishAfterTransition(); // NavUtils.navigateUpFromSameTask(this); return true; } return super.onOptionsItemSelected(item); } }