aboutsummaryrefslogtreecommitdiff
path: root/src/github/daneren2005
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2015-03-30 17:30:07 -0700
committerScott Jackson <daneren2005@gmail.com>2015-03-30 17:30:07 -0700
commit6bdfe3f1b2673389ebfd636b0513cc8e89fa030a (patch)
treedcfa4bdb0820e6191755ae02091aba422f67405f /src/github/daneren2005
parenteb23df04d814deb9405ae28db13d62264085cd6c (diff)
downloaddsub-6bdfe3f1b2673389ebfd636b0513cc8e89fa030a.tar.gz
dsub-6bdfe3f1b2673389ebfd636b0513cc8e89fa030a.tar.bz2
dsub-6bdfe3f1b2673389ebfd636b0513cc8e89fa030a.zip
Fix fragments not having a context before onCreateOptionsMenu sometimes
Diffstat (limited to 'src/github/daneren2005')
-rw-r--r--src/github/daneren2005/dsub/activity/SubsonicActivity.java1
-rw-r--r--src/github/daneren2005/dsub/fragments/SubsonicFragment.java4
2 files changed, 5 insertions, 0 deletions
diff --git a/src/github/daneren2005/dsub/activity/SubsonicActivity.java b/src/github/daneren2005/dsub/activity/SubsonicActivity.java
index d5821dac..5c355eaf 100644
--- a/src/github/daneren2005/dsub/activity/SubsonicActivity.java
+++ b/src/github/daneren2005/dsub/activity/SubsonicActivity.java
@@ -349,6 +349,7 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte
menuInflater.inflate(R.menu.drawer_menu, menu);
} else if(currentFragment != null) {
try {
+ currentFragment.setContext(this);
currentFragment.onCreateOptionsMenu(menu, menuInflater);
} catch(Exception e) {
Log.w(TAG, "Error on creating options menu", e);
diff --git a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java
index fcba86a2..1e2d2ad8 100644
--- a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java
+++ b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java
@@ -164,6 +164,10 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR
context = (SubsonicActivity)activity;
}
+ public void setContext(SubsonicActivity context) {
+ this.context = context;
+ }
+
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {