mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-31 14:53:59 +01:00 
			
		
		
		
	Check ShareActionprovider is not null
This commit is contained in:
		
							parent
							
								
									8ba07b0c9c
								
							
						
					
					
						commit
						ab3ef33c10
					
				
					 2 changed files with 9 additions and 5 deletions
				
			
		|  | @ -222,10 +222,14 @@ public class MediaDetailPagerFragment extends Fragment implements ViewPager.OnPa | |||
| 
 | ||||
|                     // Set ShareActionProvider Intent | ||||
|                     ShareActionProvider mShareActionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(menu.findItem(R.id.menu_share_current_image)); | ||||
|                     Intent shareIntent = new Intent(Intent.ACTION_SEND); | ||||
|                     shareIntent.setType("text/plain"); | ||||
|                     shareIntent.putExtra(Intent.EXTRA_TEXT, m.getDisplayTitle() + " \n" + m.getDescriptionUrl()); | ||||
|                     mShareActionProvider.setShareIntent(shareIntent); | ||||
|                     // On some phones null is returned for some reason: | ||||
|                     // https://github.com/commons-app/apps-android-commons/issues/413 | ||||
|                     if(mShareActionProvider != null) { | ||||
|                         Intent shareIntent = new Intent(Intent.ACTION_SEND); | ||||
|                         shareIntent.setType("text/plain"); | ||||
|                         shareIntent.putExtra(Intent.EXTRA_TEXT, m.getDisplayTitle() + " \n" + m.getDescriptionUrl()); | ||||
|                         mShareActionProvider.setShareIntent(shareIntent); | ||||
|                     } | ||||
| 
 | ||||
|                     if(m instanceof Contribution) { | ||||
|                         Contribution c = (Contribution)m; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Adam Jones
						Adam Jones