Skip to content
This repository has been archived by the owner on Mar 9, 2019. It is now read-only.

Application crashes on pre-nougat devices when sharing a post from post details screen. #9

Closed
crazyhitty opened this issue Feb 15, 2017 · 1 comment
Assignees
Labels

Comments

@crazyhitty
Copy link
Owner

Application crashes whenever user shares any post from its details screen.

Exception android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
android.app.ContextImpl.startActivity (ContextImpl.java:677)
android.app.ContextImpl.startActivity (ContextImpl.java:664)
android.content.ContextWrapper.startActivity (ContextWrapper.java:331)
com.crazyhitty.chdev.ks.predator.core.postDetails.PostDetailsPresenter.sharePostDetails (PostDetailsPresenter.java:550)
com.crazyhitty.chdev.ks.predator.ui.activities.PostDetailsActivity.onOptionsItemSelected (PostDetailsActivity.java:484)
android.app.Activity.onMenuItemSelected (Activity.java:2964)
android.support.v4.app.FragmentActivity.onMenuItemSelected (FragmentActivity.java:408)
android.support.v7.app.AppCompatActivity.onMenuItemSelected (AppCompatActivity.java:195)
android.support.v7.view.WindowCallbackWrapper.onMenuItemSelected (WindowCallbackWrapper.java:113)
android.support.v7.view.WindowCallbackWrapper.onMenuItemSelected (WindowCallbackWrapper.java:113)
android.support.v7.app.ToolbarActionBar$2.onMenuItemClick (ToolbarActionBar.java:69)
android.support.v7.widget.Toolbar$1.onMenuItemClick (Toolbar.java:206)
android.support.v7.widget.ActionMenuView$MenuBuilderCallback.onMenuItemSelected (ActionMenuView.java:776)
android.support.v7.view.menu.MenuBuilder.dispatchMenuItemSelected (MenuBuilder.java:822)
android.support.v7.view.menu.MenuItemImpl.invoke (MenuItemImpl.java:156)
android.support.v7.view.menu.MenuBuilder.performItemAction (MenuBuilder.java:969)
android.support.v7.view.menu.MenuBuilder.performItemAction (MenuBuilder.java:959)
android.support.v7.widget.ActionMenuView.invokeItem (ActionMenuView.java:623)
android.support.v7.view.menu.ActionMenuItemView.onClick (ActionMenuItemView.java:154)
android.view.View.performClick (View.java:5265)
android.view.View$PerformClick.run (View.java:21534)
android.os.Handler.handleCallback (Handler.java:815)
android.os.Handler.dispatchMessage (Handler.java:104)
android.os.Looper.loop (Looper.java:207)
android.app.ActivityThread.main (ActivityThread.java:5728)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:789)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:679)

The crash indicates that the application is starting the sharing intent without FLAG_ACTIVITY_NEW_TASK flag. But the code already has it implemented. Weird bug, I guess. Will try to move sharing functionality from Presenter logic to Activity itself.

@crazyhitty crazyhitty self-assigned this Feb 15, 2017
@crazyhitty crazyhitty added the bug label Feb 15, 2017
crazyhitty added a commit that referenced this issue Feb 16, 2017
Added category support in PostDetails screen:
 1. Created a separate table in db for categories.
 2. Categories are fetched from ProductHunt API, if somehow the categories cannot be fetched the system will automatically fallback and load local .json file containing categories.
 3. Category and Votes count will now be displayed alongside post's publish time in PostDetails screen.
 4. Fixed a bug where application was crashing while sharing post from its details screen on pre-nougat devices.

Resolves: #7, #9
@crazyhitty
Copy link
Owner Author

Fixed the issue by moving the UI related presenter logic into the actual activity itself (only for PostDetailsActivity).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant