@TargetApi(Build.VERSION_CODES.HONEYCOMB) @SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { setTheme(SampleList.THEME); super.onCreate(savedInstanceState); setContentView(R.layout.main); Intent it = getIntent(); if (it != null) { Bundle params = it.getExtras(); if (params != null) { titulo = params.getString("titulo"); } } getSupportActionBar().setTitle(titulo); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) { BitmapDrawable bg = (BitmapDrawable) getResources().getDrawable(R.drawable.bg_striped_img); bg.setTileModeXY(TileMode.REPEAT, TileMode.REPEAT); getSupportActionBar().setBackgroundDrawable(bg); } else { ActionBar bar = getActionBar(); bar.setBackgroundDrawable(new ColorDrawable(Color.rgb(51, 51, 51))); } StaggeredGridView gridView = (StaggeredGridView) this.findViewById(R.id.staggeredGridView1); int margin = getResources().getDimensionPixelSize(R.dimen.margin); gridView.setItemMargin(margin); // set the GridView margin gridView.setPadding(margin, 0, margin, 0); // have the margin on the // sides as well StaggeredAdapter adapter = new StaggeredAdapter(MainDetails.this, R.id.imageView1, urls); gridView.setOnItemClickListener(this); gridView.setAdapter(adapter); adapter.notifyDataSetChanged(); }