@@ -95,7 +95,7 @@ public void startGalleryPick() {
9595
9696 public void handleImagePicked (int requestCode , @ Nullable Uri uri , boolean isDirectUpload , String wikiDataEntityId ) {
9797 FragmentActivity activity = fragment .getActivity ();
98- Timber .d ("handleImagePicked() called with onActivityResult()" );
98+ Timber .d ("handleImagePicked() called with onActivityResult(). Boolean isDirectUpload: " + isDirectUpload + "String wikiDataEntityId: " + wikiDataEntityId );
9999 Intent shareIntent = new Intent (activity , ShareActivity .class );
100100 shareIntent .setAction (ACTION_SEND );
101101 switch (requestCode ) {
@@ -113,21 +113,26 @@ public void handleImagePicked(int requestCode, @Nullable Uri uri, boolean isDire
113113 shareIntent .setType ("image/jpeg" );
114114 shareIntent .putExtra (EXTRA_STREAM , lastGeneratedCaptureUri );
115115 shareIntent .putExtra (EXTRA_SOURCE , SOURCE_CAMERA );
116-
117116 break ;
118117 default :
119118 break ;
120119 }
120+
121121 Timber .i ("Image selected" );
122+ shareIntent .putExtra ("isDirectUpload" , isDirectUpload );
123+ Timber .d ("Put extras into image intent, isDirectUpload is " + isDirectUpload );
124+
122125 try {
123- shareIntent .putExtra ("isDirectUpload" , isDirectUpload );
124126 if (wikiDataEntityId != null && !wikiDataEntityId .equals ("" )) {
125127 shareIntent .putExtra (WIKIDATA_ENTITY_ID_PREF , wikiDataEntityId );
126128 }
127- activity .startActivity (shareIntent );
128129 } catch (SecurityException e ) {
129130 Timber .e (e , "Security Exception" );
130131 }
132+
133+ if (activity != null ) {
134+ activity .startActivity (shareIntent );
135+ }
131136 }
132137
133138 void saveState (Bundle outState ) {
0 commit comments