Skip to content

Instantly share code, notes, and snippets.

@sabadow
sabadow / gist:3841866
Created October 5, 2012 19:33
Example of rounded image with inline css
<img style="border-radius: 30px;"
src="http://static.myopera.com/community/graphics/speeddials/Opera-Background-Colored-Lights.jpg"/>
@sabadow
sabadow / gist:2584309
Created May 3, 2012 08:22
Add a Filter on an ArrayAdapter to AutoCompleteTextView (Android)
@Override
public Filter getFilter() {
Filter myFilter = new Filter() {
@Override
protected FilterResults performFiltering(CharSequence constraint) {
FilterResults filterResults = new FilterResults();
if(constraint != null) {
List<GenericProduct> filteredProducts = new ArrayList<GenericProduct>();
for(GenericProduct currentGenericProduct : genericProductList){
if(currentGenericProduct.getName().contains(constraint)){
@sabadow
sabadow / gist:1788703
Created February 10, 2012 10:44
Check if Android Intent is available
/**
* Check if an Intent is available to use
* @param intent the Intent to check if is available
* @return true if is available, false otherwise
*/
private boolean isIntentAvailable(Intent intent) {
List<ResolveInfo> list = getPackageManager().queryIntentActivities(intent,
PackageManager.MATCH_DEFAULT_ONLY);
return list.size() > 0;
}
@sabadow
sabadow / gist:1778654
Created February 9, 2012 09:12
Launch Twitter official client from Android through an Intent
Intent tweetIntent = new Intent(Intent.ACTION_SEND);
tweetIntent.putExtra(Intent.EXTRA_TEXT, "This is a Test.");
tweetIntent.setType("text/plain");
PackageManager packManager = getPackageManager();
List<ResolveInfo> resolvedInfoList = packManager.
queryIntentActivities(tweetIntent, PackageManager.MATCH_DEFAULT_ONLY);
boolean resolved = false;
for(ResolveInfo resolveInfo: resolvedInfoList){