Better tryOpenUri implementation and toast string.
Got the if/else hint from http://developer.android.com/about/versions/android-4.3.html#Behaviors (much better than try/except anyway)
This commit is contained in:
		
							parent
							
								
									560b7392cf
								
							
						
					
					
						commit
						afe102e90a
					
				@ -183,7 +183,7 @@
 | 
				
			|||||||
    <string name="permissions_for_long">Permissions for version %s</string>
 | 
					    <string name="permissions_for_long">Permissions for version %s</string>
 | 
				
			||||||
    <string name="showPermissions">Show permissions</string>
 | 
					    <string name="showPermissions">Show permissions</string>
 | 
				
			||||||
    <string name="showPermissions_long">Display a list of permissions an app needs</string>
 | 
					    <string name="showPermissions_long">Display a list of permissions an app needs</string>
 | 
				
			||||||
    <string name="no_handler_app">You don\'t have any app installed that can handle %s</string>
 | 
					    <string name="no_handler_app">You don\'t have any available app that can handle %s</string>
 | 
				
			||||||
    <string name="compactlayout">Compact Layout</string>
 | 
					    <string name="compactlayout">Compact Layout</string>
 | 
				
			||||||
    <string name="compactlayout_long">Only show app names and summaries in list</string>
 | 
					    <string name="compactlayout_long">Only show app names and summaries in list</string>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -634,14 +634,15 @@ public class AppDetails extends ListActivity {
 | 
				
			|||||||
        return true;
 | 
					        return true;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void tryOpenUri(String s) {
 | 
					    public void tryOpenUri(String s) {
 | 
				
			||||||
        try {
 | 
					        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(s));
 | 
				
			||||||
            startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(s)));
 | 
					        if (intent.resolveActivity(getPackageManager()) != null)
 | 
				
			||||||
        } catch (android.content.ActivityNotFoundException e) {
 | 
					            startActivity(intent);
 | 
				
			||||||
            Toast toast = Toast.makeText(this,
 | 
					        else
 | 
				
			||||||
                    getString(R.string.no_handler_app, s), Toast.LENGTH_LONG);
 | 
					            Toast.makeText(this,
 | 
				
			||||||
            toast.show();
 | 
					                    getString(R.string.no_handler_app, intent.getDataString()),
 | 
				
			||||||
        }
 | 
					                    Toast.LENGTH_LONG).show();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user