Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 2nd, 2012  |  syntax: None  |  size: 0.80 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Toast.makeText from resource string
  2. startActivityForResult(myIntentOfMyClassForResult, ACTIVITY_EDIT_BTEXT);
  3.        
  4. Context c = myClassForResult.this;
  5. Toast toast = Toast.makeText(c,
  6.     c.getResources().getString(R.string.my_resource_string),
  7.     Toast.LENGTH_SHORT);
  8. toast.show();
  9.        
  10. Context c = MyPrimaryClass.this;
  11. Toast toast = Toast.makeText(c,
  12.     R.string.my_resource_string,
  13.     Toast.LENGTH_SHORT);
  14. toast.show();
  15.        
  16. Context c = MyPrimaryClass.this;
  17. Toast toast = Toast.makeText(c,
  18.     R.string.my_resource_string,
  19.     Toast.LENGTH_LONG);
  20. toast.show();
  21.        
  22. Toast toast = Toast.makeText(c,
  23.     c.getResources().getString(R.string.my_resource_string),
  24.     Toast.LENGTH_SHORT);
  25. toast.show();
  26.        
  27. Toast.makeText(c,
  28.     c.getResources().getString(R.string.my_resource_string),
  29.     Toast.LENGTH_SHORT).show();