5/20/12

How to make screen (or window) in Adndroid

In android programming, screen or window object named Activity.
Here is example code that display list of items from simple strings array :
public class NisuiActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        ListView lv= (ListView)findViewById(R.id.listview);

        

        // create the grid item mapping

        String[] from = new String[] {"rowid"};
        int[] to = new int[] { R.id.item1 };

 

        // prepare the list of all records

        List<hashmap<string, string>> fillMaps = new ArrayList<hashmap<string, string>>();

        for(int i = 0; i < 10; i++){

            HashMap<string, string> map = new HashMap<string, string>();
            map.put("rowid", "" + i);

            fillMaps.add(map);

        }

 

        // fill in the grid_item layout
        SimpleAdapter adapter = new SimpleAdapter(this, fillMaps, R.layout.grid_item, from, to);
        lv.setAdapter(adapter);        
        
        
    }

}

When you run the code you got something like this:

Getting started with docker

It is very simple to get started usig docker. All you need to do-is download the docker desktop for your system Once you get docker syste...