Skip to content

Commit 1b9375a

Browse files
committed
web browser: fragment instantiation fix
1 parent 48362ba commit 1b9375a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

smarttubetv/src/main/java/com/liskovsoft/smartyoutubetv2/tv/ui/webbrowser/WebBrowserActivity.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import android.os.Bundle;
44

5+
import com.liskovsoft.sharedutils.helpers.MessageHelpers;
56
import com.liskovsoft.smartyoutubetv2.tv.R;
67
import com.liskovsoft.smartyoutubetv2.tv.ui.common.LeanbackActivity;
78

@@ -12,7 +13,15 @@ public class WebBrowserActivity extends LeanbackActivity {
1213
public void onCreate(Bundle savedInstanceState) {
1314
super.onCreate(savedInstanceState);
1415

16+
// Caused by android.app.Fragment$InstantiationException
17+
// Trying to instantiate a class com.liskovsoft.smartyoutubetv2.tv.ui.webbrowser.WebBrowserFragment that is not a Fragment
1518
// WebBrowserFragment is not a Fragment: ClassCastException or Fragment.InstantiationException
16-
setContentView(R.layout.fragment_webbrowser);
19+
try {
20+
setContentView(R.layout.fragment_webbrowser);
21+
} catch (Exception e) {
22+
e.printStackTrace();
23+
MessageHelpers.showMessage(this, e.getMessage());
24+
finish();
25+
}
1726
}
1827
}

0 commit comments

Comments
 (0)