Android application components can connect to other Android applications. This connection is based on a task description represented by an Intent object.Intents are objects of the android.content.Intent type. Your code can send them to the Android system defining the components you are targeting. For example, via the startactivity() method you can define that the intent should be used to start an activity. An intent can contain data via a Bundle. This data can be used by the receiving component.
Intent i = new Intent(MainActivity.this , ActivityTwo.class);
i.putExtra(“Value1″ , ” “);
i.putExtra(“Value2″ , ” “);
Listview
ListView is a view group that displays a list of scrollable items. The list items are automatically inserted to the list using an Adapter that pulls content from a source such as an array or database query and converts each item result into a view that’s placed into the list.
An adapter actually bridges between UI components and the data source that fill data into UI Component. Adapter holds the data and send the data to adapter view, the view can takes the data from adapter view and shows the data on different views like as spinner, list view, grid view etc.
The ListView and GridView are subclasses of AdapterView and they can be populated by binding them to an Adapter, which retrieves data from an external source and creates a View that represents each data entry.
ArrayList<String> list = new ArrayList<>();
list.add(“fruits”);
list.add(“vegetables”);
list.add(“drinks”);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,list);
l.setAdapter(adapter);
Comments
Post a Comment