protected void showList(){ try { JSONObject jsonObj = new JSONObject(myJSON); peoples = jsonObj.getJSONArray(TAG_RESULTS); for(int i=0;i<peoples.length();i++){ JSONObject c = peoples.getJSONObject(i); String id = c.getString(TAG_ID); String url = c.getString(TAG_URL); Listitem.add(new Listitem(id,url)); } adapter = new GridViewAdapter(this, R.layout.grid_item_layout, Listitem); list.setAdapter(adapter); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalStateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_first); Button button = (Button) findViewById(R.id.button); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // Step 1: Build an ArrayList to pass to the next Activity ArrayList<Listitem> items = new ArrayList<Listitem>(); items.add(new Listitem("1", "http://developer.android.com/assets/images/android_logo.png")); items.add(new Listitem("2", "https://i.stack.imgur.com/B28Ca.jpg?s=328&g=1")); // Step 2: Create an Intent to start the next Activity Intent intent = new Intent(getApplicationContext(), SingleViewActivity.class); // Step 3: Put the ArrayList into the Intent intent.putParcelableArrayListExtra(SingleViewActivity.ARG_PERSON_LIST, items); // Step 4: Start the next Activity startActivity(intent); } }); } }
private Listitem newListitem(ListitemRenderer renderer) { Listitem item = null; if (renderer instanceof ListitemRendererExt) item = ((ListitemRendererExt) renderer).newListitem(_listbox); if (item == null) { item = new Listitem(); item.applyProperties(); } return item; }
/** * Appends an item. * * <p> * Note: if live data is used ({@link #getModel} is not null), the returned * item might NOT be loaded yet. To ensure it is loaded, you have to invoke * {@link #renderItem}. */ public Listitem appendItem(String label, String value) { final Listitem item = new Listitem(label, value); item.applyProperties(); item.setParent(this); return item; }
/** * Add an item to the list box. * * @param value = Value of item to add. */ public void addItem(String value) { Listitem item = new Listitem(); item.setLabel(value); appendChild(item); if (value.equalsIgnoreCase(defaultValue)) { item.setStyle("font-style:italic"); } } }
public void doAfterCompose(Component comp) throws Exception { super.doAfterCompose(comp); for(int i=0;i<=10;i++){ Listitem li = new Listitem(); Listcell lic = new ListCell(); li.appendChild(lic); Button myBtn = new Button("Btn"); myBtn.setParent(lic); //... } }
private Listcell getCell(int col, int row) { Listitem item; while (row >= lstVitals.getItemCount()) { item = new Listitem(); item.setVisible(false); item.setParent(lstVitals); } item = lstVitals.getItemAtIndex(row); while (col >= item.getChildren().size()) { Listcell cell = new Listcell(""); cell.setParent(item); } return (Listcell) item.getChildren().get(col); }
Listitem item = new Listitem(); item.addForward(Events.ON_DOUBLE_CLICK, btnSelect, Events.ON_CLICK); lbResults.appendChild(item);
/** * Adds the service location to the specified listbox. * * @param location Service location to add. * @param lstLocation Listbox to receive the location. * @return The added list item. */ public static Listitem locationAdd(Location location, Listbox lstLocation) { Listitem item = new Listitem(location.getName()); item.setValue(location); //item.setTooltiptext(location.getDescription()); item.addForward(Events.ON_DOUBLE_CLICK, "btnOK", Events.ON_CLICK); lstLocation.appendChild(item); lstLocation.setDisabled(false); return item; }
/** * Adds the service location to the specified listbox. * * @param location Service location to add. * @param lstLocation Listbox to receive the location. * @return The added list item. */ public static Listitem locationAdd(Location location, Listbox lstLocation) { Listitem item = new Listitem(location.getName().getValue()); item.setValue(location); //item.setTooltiptext(location.getDescription()); item.addForward(Events.ON_DOUBLE_CLICK, "btnOK", Events.ON_CLICK); lstLocation.appendChild(item); lstLocation.setDisabled(false); return item; }
@Override public void doAfterCompose(Component comp) throws Exception { super.doAfterCompose(comp); String[] subsets = (String[]) arg.get("subsets"); TermSubset termSubsets = TermUtil.getSubset(null); for (String subset : subsets) { Listitem item = new Listitem(termSubsets.getMemberName(subset)); item.setValue(subset); lbSubset.appendChild(item); } if (subsets.length == 1) { pnlSubset.setVisible(false); lbSubset.setSelectedIndex(0); ((Window) root).getCaption().setLabel(lbSubset.getSelectedItem().getLabel()); } treeSearch.setItemRenderer(termMatchRenderer); }
Listitem li = new Listitem(); li.setValue(securityDomain); lstDomain.appendChild(li);
final Listitem li = new Listitem(); li.setValue(organization); j_domain.appendChild(li);
/** * Creates and returns a draggable list item. * * @param associateEvents If true, associate events with this item. * @return New list item. */ private Listitem newListitem(boolean associateEvents) { Listitem item = new Listitem(); if (associateEvents) { associateEvents(item); } String label = "Drop item #" + ++itemCount + (associateEvents ? " *" : ""); item.setLabel(label); // Set to info panel drop id. item.setDraggable(IInfoPanel.DROP_ID); // Create and attach the object to be rendered. DroppedItem dropped = new DroppedItem(label, "This is the detail for drop item #" + itemCount); item.setValue(dropped); // Associate the drop renderer with the item. DropUtil.setDropRenderer(item, dropRenderer); return item; }
private void renderNote(ProblemNote pn) { Listitem item = new Listitem(); lstNotes.appendChild(item); Listcell cell = addCell(item, ""); cell.setSclass("bgo-problem-icon-cell"); Toolbarbutton btn = new Toolbarbutton("", DELETE_ICON); btn.setTooltiptext("Delete this note."); btn.addForward(Events.ON_CLICK, lstNotes, "onDeleteNote"); cell.appendChild(btn); addCell(item, pn.getNumber()); // Note # addCell(item, pn.getNarrative()).setHflex("1"); // Narrative addCell(item, DateUtil.formatDate(pn.getDateAdded())); // Date added addCell(item, pn.getAuthor()); // Author item.setValue(pn); }