Guest User

Untitled

a guest
Apr 23rd, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. protected override void OnCreate(Bundle savedInstanceState)
  2. {
  3. Intent intent =Intent;
  4. String action = Intent.Action;
  5. String type = intent.Type;
  6.  
  7. if (Intent.ActionSend.Equals(action) && type != null)
  8. {
  9. if ("text/plain".Equals(type))
  10. {
  11. // Handle text being sent
  12. // ...
  13. // ...
  14. // ...
  15. var mainintent = new Intent(this, typeof(MainActivity));
  16. StartActivity(mainintent);
  17. }
  18. else if (type.StartsWith("image/"))
  19. {
  20. // Handle single image being sent
  21. // ...
  22. // ...
  23. // ...
  24. var mainintent = new Intent(this, typeof(MainActivity));
  25. StartActivity(mainintent);
  26. }
  27. }
  28. else if (Intent.ActionSendMultiple.Equals(action) && type != null)
  29. {
  30. if (type.StartsWith("image/"))
  31. {
  32. // Handle multiple images being sent
  33. // ...
  34. // ...
  35. // ...
  36. var mainintent = new Intent(this, typeof(MainActivity));
  37. StartActivity(mainintent);
  38. }
  39. }
  40. else
  41. {
  42. // Handle other intents, such as being started from the home screen
  43. }
  44. }
Add Comment
Please, Sign In to add comment