Lesson 5. List-Based Selectors. List-Based Selector: Lists, Grids, and Scroll Views... 3

Size: px
Start display at page:

Download "Lesson 5. List-Based Selectors. List-Based Selector: Lists, Grids, and Scroll Views... 3"

Transcription

1 Lesson 5. List-Based Selectors List-Based Selector: Lists, Grids, and Scroll Views... 3

2

3 List-Based Selector: Lesson 5 Lists, Grids, and Scroll Views Goals Discrete and List-Based Selectors

4 ListViews and ArrayAdapters TextView TextView ArrayList tostring() getview( ) Example 5.1 A simple ListView based app (Version 1)

5 <LinearLayout xmlns:android=" xmlns:tools=" android:layout_height="match_parent" android:orientation="vertical"> <TextView android:background="#ffffff00" android:text="using ListViews..." android:textsize="16sp" /> <ListView android:layout_height="match_parent" > </ListView> <TextView android:background="#ffff0000" android:text="empty list" /> Using predefined See Appendix A for a description of these elements </LinearLayout> package matos.csu.listapp; import android.app.listactivity; import android.graphics.color; import android.os.bundle; import android.view.view; import android.widget.arrayadapter; import android.widget.listview; import android.widget.textview; public class MainActivity extends ListActivity { TextView txtmsg; String[] items = {"Data-0", "Data-1", "Data-2", "Data-3", "Data-4", "Data-5", "Data-6", "Data-7"; // next time try an empty list such as:

6 // String[] items = {; public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); setlistadapter(new ArrayAdapter<String>(this, android.r.layout.simple_list_item_1, items)); getlistview().setbackgroundcolor(color.white); txtmsg = (TextView) findviewbyid(r.id.txtmsg); protected void onlistitemclick(listview l, View v, int position, long id) { super.onlistitemclick(l, v, position, id); String text = " Position: " + position + " " + items[position]; ListActivity Activity oncreate SetListAdapter ArrayAdapter<String>.

7 'this' android.r.layout.simple_list_item_1 'items' items tostring() <String> android.r.layout.simple_list_item_1 items getlistview().setbackgroundcolor(color.white) onlistitemclick onlistitemclick Note oncreate Code > Override Methods > onlistitemclick Example 5.2 A simple ListView based app (Version 2) ListActivity Adapter ListView Activity <LinearLayout xmlns:android=" xmlns:tools=" android:layout_height="match_parent" android:orientation="vertical"> <TextView android:id="@+id/txtmsg"

8 android:text="using ListViews..." /> <ListView android:layout_height="match_parent" </ListView> </LinearLayout> MainActivity ListActivity mylistview mylistview setonitemclicklistener mylistview.setadapter(myarrayadapter) public class MainActivity extends Activity { String[] items = { "Data-0", "Data-1", "Data-2", "Data-3", "Data-4", "Data-5", "Data-6", "Data-7" ; ListView mylistview; TextView txtmsg; public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); txtmsg = (TextView) findviewbyid(r.id.txtmsg); mylistview = (ListView) findviewbyid(r.id.my_list); ArrayAdapter<String> myarrayadapter = new ArrayAdapter<String>(this, android.r.layout.simple_list_item_1, items); mylistview.setadapter(myarrayadapter); mylistview.setonitemclicklistener(new AdapterView.OnItemClickListener() { public void onitemclick(adapterview<?> av, View v, int position, long id) { String text = "Position: " + position + "\ndata: " + items[position]; txtmsg.settext(text); ); //oncreate

9 Example 5.3 Customizing the ListView control res/layout/my_custom_row.xml <LinearLayout xmlns:android=" android:layout_height="match_parent" android:orientation="vertical" android:padding="6dp" > <TextView android:background="#220000ff" android:padding="1dp" android:textcolor="#ffff0000" android:textsize="35sp" /> </LinearLayout> (a) User-defined row layout (my_custom_row.xml) (b) A custom ListView oncreate ArrayAdapter ArrayAdapter ArrayAdapter<String> myarrayadapter = new ArrayAdapter<String>( getapplicationcontext(), R.layout.my_custom_row, R.id.my_custom_textview, items ); ArrayAdapter<String> TextView Expandable Lists: The Spinner Control

10 setadapter(). setonitemselectedlistener() Example 5.4 An app showing a Spinner selector control Spinner TextView <LinearLayout xmlns:android=" xmlns:tools=" android:layout_height="match_parent" android:background="@android:color/white" android:orientation="vertical"> Tap to drop list down <TextView android:id="@+id/txtmsg" android:background="@color/coloraccent" android:textsize="25sp" android:layout_margin="1dp" android:text="using Spinner..." /> <Spinner android:id="@+id/spinner1" /> </LinearLayout> public class MainActivity extends Activity implements AdapterView.OnItemSelectedListener{ // GUI objects TextView txtmsg; Spinner spinner;

11 // options to be offered by the spinner String[] items = { "Data-0", "Data-1", "Data-2", "Data-3", "Data-4", "Data-5", "Data-6", "Data-7" ; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); // plumbing: connecting Java to GUI objects txtmsg = (TextView) findviewbyid(r.id.txtmsg); spinner = (Spinner) findviewbyid(r.id.spinner1); // use following adapter to move data from items array to the ListView ArrayAdapter<String> adapter = new ArrayAdapter<String>( this, android.r.layout.simple_spinner_dropdown_item, items); // bind everything together spinner.setadapter(adapter); // add a listener so user can make selections by tapping an item on the list spinner.setonitemselectedlistener(this); // next two methods implement the spinner's listener public void onitemselected(adapterview<?> parent, View v, int position, long id) { // echo on the textbox the user's selection txtmsg.settext(items[position]); public void onnothingselected(adapterview<?> arg0) { // TODO do nothing needed by the interface MainActivity AdapterView.OnItemSelectedListener. Spinner onitemselected onnothingselected onitemselected() onitemselected parent TextView View v int position long id

12 GridViews GridView android:numcolumns auto_fit" android:verticalspacing android:horizontalspacing android:columnwidth android:stretchmode android:columnwidth 100dp android:horizontalspacing 5dp android:stretchmode columnwidth android:stretchmode spacingwidth

13 Example 5.5 App showing a text GridView GridView 'auto-fit TextView <LinearLayout xmlns:android=" xmlns:tools=" android:layout_height="match_parent" android:orientation="vertical" android:padding="6dp" tools:context=".mainactivity" > <TextView android:id="@+id/txtmsg" android:background="@color/coloraccent" android:textsize="24sp" android:layout_marginbottom="3dp" android:textcolor="@android:color/white" android:padding="2dip" /> <GridView android:id="@+id/gridchoice" android:background="@color/colorprimary50" android:verticalspacing="5dip" android:horizontalspacing="5dip" android:numcolumns="auto_fit" android:columnwidth="100dip" android:stretchmode="spacingwidth" /> </LinearLayout> public class MainActivity extends Activity { //GUI objects TextView txtmsg; GridView grid; //Data source String[] items = { "Data-0", "Data-1", "Data-2", "Data-3", "Data-4", "Data-5", "Data-6", "Data-7" ; public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); //plumbing: connecting Java and GUI objects

14 txtmsg = (TextView) findviewbyid(r.id.txtmsg); grid = (GridView) findviewbyid(r.id.gridchoice); //array adapter will send rows from items array to cell in the grid ArrayAdapter<String> adapter = new ArrayAdapter<String>( this, android.r.layout.simple_list_item_1, items ); //bind grid and adapter grid.setadapter(adapter); //setup a click event listener grid.setonitemclicklistener(new AdapterView.OnItemClickListener() { public void onitemclick(adapterview<?> container, View v, int position, long id) { txtmsg.settext(items[position]); ); //oncreate // class GridView MainActivity android.r.layout.simple_list_item_1 GridViews AutoComplete TextView AutoComplete android:completionthreshold

15 Example 5.6 App showing an AutoComplete box AutoText <RelativeLayout xmlns:android=" xmlns:tools=" android:padding="6dp" android:layout_height="match_parent" > <TextView android:textsize="20sp" /> <AutoCompleteTextView android:hint="type here..." android:completionthreshold="3" android:layout_width="wrap_content" android:layout_margintop="15dp" android:ems="10" /> </RelativeLayout> public class MainActivity extends Activity implements TextWatcher { // GUI objects TextView txtmsg; AutoCompleteTextView txtautocomplete; //Data source String[] items = { "words", "starting", "with", "set", "Setback", "Setline", "Setoffs", "Setouts", "Setters", "Setting", "Settled", "Settler", "Wordless", "Wordiness", "Adios" ; public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main);

16 //plumbing: connecting Java and GUI objects txtmsg = (TextView) findviewbyid(r.id.txtmsg); txtautocomplete = (AutoCompleteTextView) findviewbyid( R.id.autoCompleteTextView1); //define anonymous array adapter to provide 'suggested' words txtautocomplete.setadapter(new ArrayAdapter<String>( this, android.r.layout.simple_list_item_single_choice, items)); //setup: add TextChaned listener to Autocomplete box txtautocomplete.addtextchangedlistener(this); //oncreate //process final selection made by the user public void ontextchanged(charsequence s, int start, int before, int count) { txtmsg.settext(txtautocomplete.gettext()); public void beforetextchanged(charsequence s, int start, int count,int after) { // needed for interface, but not used public void aftertextchanged(editable s) { // needed for interface, but not used //class MainActivity AutoText AutoText TextWatcher oncreate ontextchanged s count start before sen t s="sent", start=3 s before 0. count=1 s beforetextchanged aftertextchanged TextWatcher HorizontalScrollView

17 Example 5.7 App showing a HorizontalScrollView HorizontalScrollView HorizontalScrollView HorizontalScrollView <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=" android:background="@android:color/white" android:orientation="vertical" android:padding="6dp" > <TextView android:id="@+id/txtmsg" android:background="@color/colorprimary" android:text="scroll and click to select..." android:textcolor="@android:color/white" android:layout_marginbottom="2dp" android:textappearance="?android:attr/textappearancelarge" /> <HorizontalScrollView android:layout_marginbottom="2dp" android:background="@color/coloraccent" > <LinearLayout android:id="@+id/viewgroup" android:layout_width="wrap_content" android:orientation="horizontal" android:padding="10dip" > </LinearLayout> </HorizontalScrollView> <ImageView android:id="@+id/imageselected" android:layout_weight="2" /> /LinearLayout>

18 LinearLayout HorizontalScrollView <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=" android:orientation="vertical" android:padding="2dp"> <ImageView android:layout_width="100dp" android:layout_height="100dp" android:layout_gravity="center" android:paddingleft="2dp" android:paddingright="2dp" android:paddingtop="2dp" inflater HorizontalScrollerView <TextView android:layout_width="100dp" android:layout_gravity="center" android:background="#03a9f4" android:gravity="center" android:text="caption" android:textsize="20sp"/> <!-- Blue500 --> onclick </LinearLayout> res/drawable frame_icon_caption

19 res/drawable public class MainActivity extends Activity { //GUI controls TextView txtmsg; ViewGroup scrollviewgroup; //large image frame for displaying high-quality selected image ImageView imageselected; //each frame in the ScrollView has [icon, caption] ImageView icon; TextView caption; //frame captions ❶ String[] items = {"Photo-00", "Photo-01", "Photo-02", "Photo-03", "Photo-04", "Photo-05", "Photo-06", "Photo-07", "Photo-08", "Photo-09", "Photo-10", "Photo-11", "Photo-12", "Photo-13", "Photo-14", "Photo-15", "Photo-16", "Photo-17", "Photo-18", "Photo-19", "Photo-20", "Photo-21", "Photo-22", "Photo-23", "Photo-24", "Photo-25", "Photo-26", ; //frame-icons ( 100X100 thumbnails ) Integer[] thumbnails = { R.drawable.small_pic00, R.drawable.small_pic01, R.drawable.small_pic02,R.drawable.small_pic03, R.drawable.small_pic04, R.drawable.small_pic05,R.drawable.small_pic06, R.drawable.small_pic07, R.drawable.small_pic08,R.drawable.small_pic09, R.drawable.small_pic10, R.drawable.small_pic11,R.drawable.small_pic12, R.drawable.small_pic13, R.drawable.small_pic14,R.drawable.small_pic15, R.drawable.small_pic16, R.drawable.small_pic17,R.drawable.small_pic18, R.drawable.small_pic19, R.drawable.small_pic20,R.drawable.small_pic21, R.drawable.small_pic22, R.drawable.small_pic23,R.drawable.small_pic24, R.drawable.small_pic25, R.drawable.small_pic26 ; ❷ //hi-resolution images Integer[] largeimages = { R.drawable.large_pic00, R.drawable.large_pic01, R.drawable.large_pic02,R.drawable.large_pic03, R.drawable.large_pic04, R.drawable.large_pic05,R.drawable.large_pic06, R.drawable.large_pic07, R.drawable.large_pic08,R.drawable.large_pic09, R.drawable.large_pic10, R.drawable.large_pic11,R.drawable.large_pic12, R.drawable.large_pic13, R.drawable.large_pic14,R.drawable.large_pic15, R.drawable.large_pic16, R.drawable.large_pic17,R.drawable.large_pic18, R.drawable.large_pic19, R.drawable.large_pic20,R.drawable.large_pic21, R.drawable.large_pic22, R.drawable.large_pic23 ❸

20 ,R.drawable.large_pic24, R.drawable.large_pic25, R.drawable.large_pic26 ; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); //bind GUI controls to Java classes txtmsg = (TextView) findviewbyid(r.id.txtmsg); imageselected = (ImageView) findviewbyid(r.id.imageselected); // this layout goes inside the HorizontalScrollView scrollviewgroup = (ViewGroup) findviewbyid(r.id.viewgroup); for (int i = 0; i < items.length; i++) { //create single frames [icon & caption] using XML inflater final View singleframe = getlayoutinflater().inflate( R.layout.frame_icon_caption, null ); //frame-0, frame-1, frame-2,... and so on singleframe.setid(i); ❹ TextView caption = (TextView) singleframe.findviewbyid(r.id.caption); ImageView icon = (ImageView) singleframe.findviewbyid(r.id.icon); //put data [icon, caption] in each single frame icon.setimageresource( thumbnails[i] ); caption.settext( items[i] ); //add frame to the scrollview scrollviewgroup.addview( singleframe ); //each single frame gets its own click listener singleframe.setonclicklistener(new View.OnClickListener() { public void onclick(view v) { String text = "Selected position: " + singleframe.getid(); txtmsg.settext(text); showlargeimage(singleframe.getid()); );// listener // for //oncreate // display a high-quality version of the image selected using thumbnails ❺ protected void showlargeimage(int frameid) { Drawable selectedlargeimage = getresources().getdrawable( largeimages[frameid]); imageselected.setbackground(selectedlargeimage);

21 items' res/drawable xxxhdpi hi-res getlayoutinflater().inflate() frame_icon_caption.xml singleframe.setid(i) onclick getresources().getdrawable( largeimages[frameid]) res/drawable

22 Using GridViews to show images Example 5.8 App showing an image-based GridView GridView <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=" android:layout_height="match_parent" android:orientation="vertical" android:padding="6dp" > <TextView android:padding="3dp" android:text="scrool screen, tap to choose" android:textcolor="#ffffffff" android:textsize="20sp" /> <GridView android:layout_height="match_parent" android:layout_margin="1dp" android:columnwidth="100dp" android:gravity="center" android:horizontalspacing="5dp" android:numcolumns="auto_fit" android:stretchmode="columnwidth" android:verticalspacing="10dp" /> </LinearLayout>

23 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=" android:layout_height="match_parent" android:padding="3dp" android:orientation="vertical" > <TextView android:textsize="25sp" /> <ImageView android:layout_height="0dip" android:layout_gravity="center fill" android:layout_weight="2" /> <Button android:layout_width="100dip" android:layout_gravity="center_horizontal" android:text="back" /> </LinearLayout>

24 public class MainActivity extends Activity { //GUI control bound to screen1 (holding GidView) GridView gridview; //GUI controls bound to screen2 (holding a single ImageView) TextView txtsolomsg; ImageView imgsolophoto; Button btnsoloback; //in case you want to use-save state values Bundle myoriginalmemorybundle; //frame captions ❶ String[] items = {"Photo-00", "Photo-01", "Photo-02", "Photo-03", "Photo-04", "Photo-05", "Photo-06", "Photo-07", "Photo-08", "Photo-09", "Photo-10", "Photo-11", "Photo-12", "Photo-13", "Photo-14", "Photo-15", "Photo-16", "Photo-17", "Photo-18", "Photo-19", "Photo-20", "Photo-21", "Photo-22", "Photo-23", "Photo-24", "Photo-25", "Photo-26", ; //frame-icons ( 100X100 thumbnails ) Integer[] thumbnails = { R.drawable.small_pic00, R.drawable.small_pic01, R.drawable.small_pic02,R.drawable.small_pic03, R.drawable.small_pic04, R.drawable.small_pic05,R.drawable.small_pic06, R.drawable.small_pic07, R.drawable.small_pic08,R.drawable.small_pic09, R.drawable.small_pic10, R.drawable.small_pic11,R.drawable.small_pic12, R.drawable.small_pic13, R.drawable.small_pic14,R.drawable.small_pic15, R.drawable.small_pic16, R.drawable.small_pic17,R.drawable.small_pic18, R.drawable.small_pic19, R.drawable.small_pic20,R.drawable.small_pic21, R.drawable.small_pic22, R.drawable.small_pic23,R.drawable.small_pic24, R.drawable.small_pic25, R.drawable.small_pic26 ; ❷ //hi-resolution images Integer[] largeimages = { R.drawable.large_pic00, R.drawable.large_pic01, R.drawable.large_pic02,R.drawable.large_pic03, R.drawable.large_pic04, R.drawable.large_pic05,R.drawable.large_pic06, R.drawable.large_pic07, R.drawable.large_pic08,R.drawable.large_pic09, R.drawable.large_pic10, R.drawable.large_pic11,R.drawable.large_pic12, R.drawable.large_pic13, R.drawable.large_pic14,R.drawable.large_pic15, R.drawable.large_pic16, R.drawable.large_pic17,R.drawable.large_pic18, R.drawable.large_pic19, R.drawable.large_pic20,R.drawable.large_pic21, R.drawable.large_pic22, R.drawable.large_pic23,R.drawable.large_pic24, R.drawable.large_pic25, R.drawable.large_pic26 ; //additional photo captions String[] photodescription = { "Turtle", "Blossom", "Building", "Cat", "Church", "Coffee", "Coffee","Dubrovnik", "Egg", "Firefighters", "Flower", "Football","Isolated", "Jetty", "Jetty", "Paraglider", "Pelican","Pelican", "Pier", "Purpursonnen Hut", "Roofs", "South Africa","Stone Arch", "Sunset", "Tangerine", "Travel", "Tree" ; ❸

25 protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); myoriginalmemorybundle = savedinstancestate; // setup GridView with its custom adapter and listener gridview = (GridView) findviewbyid(r.id.gridview); gridview.setadapter(new MyImageAdapter(this, thumbnails)); gridview.setonitemclicklistener(new AdapterView.OnItemClickListener() { public void onitemclick(adapterview<?> parent, View view, int position, long id) { ❹ showbigscreen(position); ); //oncreate // display a high-quality version of the image selected using thumbnails ❺ private void showbigscreen(int position) { // show the selected picture as a single frame in the second layout setcontentview(r.layout.solo_picture); // plumbing second layout txtsolomsg = (TextView) findviewbyid(r.id.txtsolomsg); imgsolophoto = (ImageView) findviewbyid(r.id.imgsolophoto); // set caption-and-large picture txtsolomsg.settext(" Position= " + position + " " + items[position]); imgsolophoto.setimageresource( largeimages[position] ); // set GO BACK button to return to layout1 (GridView) btnsoloback = (Button) findviewbyid(r.id.btnsoloback); btnsoloback.setonclicklistener(new View.OnClickListener() { public void onclick(view v) { // redraw the main screen showing the GridView oncreate(myoriginalmemorybundle); ); // showbigscreen //Activity res/drawable

26 res/drawable GridView GridView ArrayAdapter<String> GridView MyImageAdapter onclick ShowBigScreen() position solo_picture.xml ShowBigScreen Back // This custom adapter populates the GridView with a visual // representation of each thumbnail in the input data set. // It implements the method getview() to access // individual cells in the GridView. public class MyImageAdapter extends BaseAdapter { private Context context; // main activity s context Integer[] smallimages; // thumbnail data set public MyImageAdapter(Context mainactivitycontext, Integer[] thumbnails) { context = mainactivitycontext; smallimages = thumbnails; // how many entries are there in the data set? public int getcount() { return smallimages.length; // what is in a given 'position' in the data set? public Object getitem(int position) { return smallimages[position]; // what is the ID of data item in given 'position? public long getitemid(int position) { return position; // create a view for each thumbnail in the data set public View getview(int position, View convertview, ViewGroup parent) {

27 ImageView imageview; // if possible, reuse (convertview) image already held in cache if (convertview == null) { // new image in GridView formatted to: 100x75 pixels (its actual size) // center-cropped, and 5dp padding all around imageview = new ImageView(context); imageview.setlayoutparams( new GridView.LayoutParams(100, 75) ); //height, width imageview.setscaletype(imageview.scaletype.center_crop); imageview.setpadding(5, 5, 5, 5); //left, top, right, bottom else { imageview = (ImageView) convertview; imageview.setimageresource(smallimages[position]); return imageview; //MyImageAdapter GridView context smallimages getview() 'convertview' getview Customizing a ListView android.r.layout.simple_list_item_2 android.r.layout.simple_list_item_1, DataAdapter ArrayAdapter getview()

28 Example 5.9 App showing a custom list design ListActivity <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=" android:layout_height="match_parent" android:padding="6dp" android:background="@android:color/white" android:orientation="vertical" > <TextView android:id="@+id/txtmsg" android:background="@color/colorprimary" android:text="your selection is..." android:textcolor="@android:color/white" android:textsize="24sp" android:textstyle="bold" /> <ListView android:id="@android:id/list" android:layout_height="match_parent" > </ListView> </LinearLayout> ListView ListActivity <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=" android:layout_width="fill_parent" android:background="@drawable/custom_row_touched" android:padding="6dp" android:orientation="horizontal"> <ImageView android:id="@+id/icon"

29 android:layout_width="100dp" android:layout_height="75dp" android:layout_marginright="3dp" <LinearLayout android:layout_height="75dp" android:orientation="vertical" android:padding="5dp"> <TextView android:text="label1" android:textsize="25sp" android:textstyle="bold"/> <TextView android:layout_margintop="10dp" android:text="label2" android:textsize="15sp"/> </LinearLayout> LinearLayout background item <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android=" <item android:state_pressed="true"> <shape android:shape="rectangle"> <solid

30 <stroke android:width="1dp" </shape> </item> </selector> res/values/colors res/values/colors.xml <?xml version="1.0" encoding="utf-8"?> <resources> <color name="colorprimary">#3f51b5</color> <color name="colorprimarydark">#303f9f</color> <color name="coloraccent">#ff4081</color> <color name="blue_100">#bbdefb</color> <color name="blue_200">#64f5b6</color> </resources> public class MainActivity extends ListActivity { TextView txtmsg; // The n-th row (frame) in the list includes an icon, a label, and a description // where icon = thumbnail[n], label=items[n], and photodescription[n] //frame captions String[] items = {"Photo-00", "Photo-01", "Photo-02", "Photo-03", "Photo-04", "Photo-05", "Photo-06", "Photo-07", "Photo-08", "Photo-09", "Photo-10", "Photo-11", "Photo-12", "Photo-13", "Photo-14", "Photo-15", "Photo-16", "Photo-17", "Photo-18", "Photo-19", "Photo-20", "Photo-21", "Photo-22", "Photo-23", "Photo-24", "Photo-25", "Photo-26", ; //frame-icons ( 100X100 thumbnails ) Integer[] thumbnails = { R.drawable.small_pic00, R.drawable.small_pic01, R.drawable.small_pic02,R.drawable.small_pic03, R.drawable.small_pic04, R.drawable.small_pic05,R.drawable.small_pic06, R.drawable.small_pic07, R.drawable.small_pic08,R.drawable.small_pic09, R.drawable.small_pic10, R.drawable.small_pic11,R.drawable.small_pic12, R.drawable.small_pic13, R.drawable.small_pic14,R.drawable.small_pic15, R.drawable.small_pic16, R.drawable.small_pic17,R.drawable.small_pic18, R.drawable.small_pic19, R.drawable.small_pic20,R.drawable.small_pic21, R.drawable.small_pic22, R.drawable.small_pic23

31 ,R.drawable.small_pic24, R.drawable.small_pic25, R.drawable.small_pic26 ; //additional photo description String[] photodescription = { "Turtle", "Blossom", "Building", "Cat", "Church", "Coffee", "Coffee","Dubrovnik", "Egg", "Firefighters", "Flower", "Football","Isolated", "Jetty", "Jetty", "Paraglider", "Pelican","Pelican", "Pier", "Purpursonnen Hut", "Roofs", "South Africa","Stone Arch", "Sunset", "Tangerine", "Travel", "Tree" ; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); txtmsg = (TextView) findviewbyid(r.id.txtmsg); // the arguments of the custom adapter are: // activity-context, layout-to-be-inflated, top labels, icons, descriptions CustomIconLabelAdapter adapter = new CustomIconLabelAdapter( this, R.layout.custom_row_icon_label, items, thumbnails, photodescription); // bind intrinsic ListView to custom adapter setlistadapter(adapter); //oncreate // react to user's selection of a row protected void onlistitemclick(listview l, View v, int position, long id) { super.onlistitemclick(l, v, position, id); String text = " Position: " + position + " " + items[position]; txtmsg.settext(text); //listener ❶ //class class CustomIconLabelAdapter extends ArrayAdapter<String> { //keep references to data sources defined in the MainActivity class private Context context; private Integer[] thumbnails; private String[] items; private String[] photodescription; public CustomIconLabelAdapter( Context context, int layouttobeinflated,

32 String[] items, Integer[] thumbnails, String[] photodescription) { super(context, R.layout.custom_row_icon_label, items); this.context = context; this.thumbnails = thumbnails; this.items = items; this.photodescription = photodescription; public View getview(int position, View convertview, ViewGroup parent) { //get an inflater and get ready to prepare a template LayoutInflater inflater = ((Activity) context).getlayoutinflater(); ❷ //inflate row template having: icon + vertical-linearlayout holding label1 and label2 View row = inflater.inflate(r.layout.custom_row_icon_label, null); //plumbing: create and connect java objects to handle GUI elements LinearLayout captionholder = (LinearLayout) row.findviewbyid(r.id.captionholder); ImageView icon = (ImageView) row.findviewbyid(r.id.icon); TextView label1 = (TextView) row.findviewbyid(r.id.label1); TextView label2 = (TextView) row.findviewbyid(r.id.label2); //move data to GUI objects using java proxis icon.setimageresource(thumbnails[position]); label1.settext(items[position]); label2.settext(photodescription[position]); //alternate row backcolor: once set it to white, next to light blue100 if (position % 2 == 0) captionholder.setbackgroundcolor(contextcompat.getcolor(context, R.color.blue_100)); else captionholder.setbackgroundcolor(color.white); //done! return 'pretty' row return (row); // getview // IconicAdapter CustomIconLabelAdapter ArrayAdapter DataAdapter ListView ArrayAdapter getview() ArrayAdpater getview() ArrayAdapter

33 row.findviewbyid() position ViewHolder Storing Large Resources in the SD card res/drawable Tools>Android>Android Device Monitor Example 5.10 App reading images from the SD card (External Storage) Android Device Monitor /Pictures/thumbnail /Pictures/large Tools > Android > 1- Accessing SD files names.txt /Pictures // VERSION1. Environment class allows access to your adopted MEDIA storage strpath2sdcard = Environment.getExternalStorageDirectory().getAbsolutePath(); File namefile = new File(strPath2SDCard + "/Pictures/names.txt"); // VERSION2. Reaching specific entries in the standard Android file organization

34 String strpath2pictures = Environment.getExternalStoragePublicDirectory( Environment.DIRECTORY_PICTURES ).getabsolutepath(); File namefile = new File(strPath2Pictures, "names.txt" ); Picture Environment.DIRECTORY_PICTURES DIRECTORY_ALARMS, DIRECTORY_DCIM, DIRECTORY_DOCUMENTS, DIRECTORY_DOWNLOADS, DIRECTORY_MOVIES, DIRECTORY_MUSIC, DIRECTORY_PODCASTS, DIRECTORY_NOTIFICATIONS, DIRECTORY_RINGTONES. Scanner Pictures/thumbnail 2- Obtaining Permissions at Execution Time

35 Table API23 + Normal App Permissions (No need for run-time approval) ACCESS_LOCATION_EXTRA_COMMANDS ACCESS_NETWORK_STATE ACCESS_NOTIFICATION_POLICY ACCESS_WIFI_STATE BLUETOOTH BLUETOOTH_ADMIN BROADCAST_STICKY CHANGE_NETWORK_STATE CHANGE_WIFI_MULTICAST_STATE CHANGE_WIFI_STATE DISABLE_KEYGUARD EXPAND_STATUS_BAR GET_PACKAGE_SIZE INSTALL_SHORTCUT INTERNET KILL_BACKGROUND_PROCESSES MODIFY_AUDIO_SETTINGS NFC READ_SYNC_SETTINGS READ_SYNC_STATS RECEIVE_BOOT_COMPLETED REORDER_TASKS REQUEST_IGNORE_BATTERY_OPTIMIZATIONS REQUEST_INSTALL_PACKAGES SET_ALARM SET_TIME_ZONE SET_WALLPAPER SET_WALLPAPER_HINTS TRANSMIT_IR UNINSTALL_SHORTCUT USE_FINGERPRINT VIBRATE WAKE_LOCK WRITE_SYNC_SETTINGS Table Dangerous App Permissions Permission Group CALENDAR CAMERA CONTACTS LOCATION MICROPHONE PHONE SENSORS SMS STORAGE Permissions READ_CALENDAR, WRITE_CALENDAR CAMERA READ_CONTACTS, WRITE_CONTACTS, GET_ACCOUNTS ACCESS_FINE_LOCATION, ACCESS_COARSE_LOCATION RECORD_AUDIO READ_PHONE_STATE, CALL_PHONE, READ_CALL_LOG, WRITE_CALL_LOG, ADD_VOIC , USE_SIP, PROCESS_OUTGOING_CALLS BODY_SENSORS SEND_SMS, RECEIVE_SMS, READ_SMS, RECEIVE_WAP_PUSH, RECEIVE_MMS READ_EXTERNAL_STORAGE, WRITE_EXTERNAL_STORAGE

36 READ_EXTERNAL_STORAGE READ_EXTERNAL_STORAGE WRITE_EXTERNAL_STORAGE public class MainActivity extends Activity { //control value to signal user's granting of READ_EXTERNAL request final int MY_PERMISSIONS_REQUEST_READ_EXTERNAL = 111; //GUI controls TextView txtmsg; ViewGroup scrollviewgroup; //each frame in the HorizontalScrollView has [icon, caption] ImageView icon; TextView caption; //large image frame for displaying high-quality selected image ImageView imageselected; String[] items; int index; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); applymarshmallowpermissionmodel(); ❶ //plumbing: bind GUI controls to Java classes txtmsg = (TextView) findviewbyid(r.id.txtmsg); imageselected = (ImageView) findviewbyid(r.id.imageselected); // this layout goes inside the HorizontalScrollView scrollviewgroup = (ViewGroup) findviewbyid(r.id.viewgroup); String strpath2sdcard = "n.a.";

37 try { // VERSION1. Environment class allows access to your MEDIA files ❷ strpath2sdcard = Environment.getExternalStorageDirectory().getAbsolutePath(); //photo captions are held in a (single-line) comma-separated text file File namefile = new File(strPath2SDCard + "/Pictures/names.txt"); // VERSION2. Reaching standard Android file organization entry-points String strpath2pictures = Environment.getExternalStoragePublicDirectory( Environment.DIRECTORY_PICTURES).getAbsolutePath(); namefile = new File(strPath2Pictures, "names.txt"); Scanner scanner = new Scanner(nameFile); String line = ""; while (scanner.hasnext()) { line += scanner.nextline(); items = line.split(","); //get access to the small thumbnails - populate the horizontal-scroller String paththumbnailsfolder = new File(strPath2Pictures, "/thumbnail").getabsolutepath(); File sdpicturefiles = new File(pathThumbnailsFolder); File[] thumbnailarray = sdpicturefiles.listfiles(); txtmsg.append("\nnum files: " + thumbnailarray.length); File singlethumbnailfile; for (index = 0; index < thumbnailarray.length; index++) { ❸ singlethumbnailfile = thumbnailarray[index]; final View frame = getlayoutinflater().inflate(r.layout.frame_icon_caption, null); TextView caption = (TextView) frame.findviewbyid(r.id.caption); ImageView icon = (ImageView) frame.findviewbyid(r.id.icon); // convert (jpg, png,...) file into a drawable icon.setimagedrawable(drawable.createfrompath(singlethumbnailfile.getabsolutepath())); caption.settext(items[index]); scrollviewgroup.addview(frame); frame.setid(index); frame.setonclicklistener(new View.OnClickListener() { public void onclick(view v) { String text = "Selected position: " + frame.getid(); txtmsg.settext(text); showlargeimage(frame.getid()); ); // listener // for catch (Exception e) { txtmsg.append("\nerror: \npath=" + strpath2sdcard + "\n" + e.getmessage());

38 //oncreate //display a high-quality version of the selected thumbnail image protected void showlargeimage(int frameid) { String pathlargepicturefolder = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Pictures/large/"; // convert SD image file(jpg, png,...) into a drawable, then show into ImageView File sdlargepicturefolder = new File(pathLargePictureFolder); File[] largepicturearray = sdlargepicturefolder.listfiles(); File largeimagefile = largepicturearray[frameid]; imageselected.setimagedrawable(drawable.createfrompath( largeimagefile.getabsolutepath())); imageselected.setadjustviewbounds(true); imageselected.setscaletype(imageview.scaletype.fit_xy); //ShowLargeImage ❹ // This method enforces the new permission policy introduced in API23 ❺ private void applymarshmallowpermissionmodel() { //if we already have permission to use the external SD card then do nothing! if (ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) return; // CAUTION: We DO NOT have the necessary permissions // Should an explanation be given to the user regarding usage of external SD card? if (ActivityCompat.shouldShowRequestPermissionRationale(MainActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE)) { // Show an ASYNCHRONOUS explanation to the user, this thread will continue // cancel app if user doesn't allow reading from SD card Toast.makeText(this, "Explanation...", Toast.LENGTH_LONG).show(); //must improve! // request the permission to use SD card. ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, MY_PERMISSIONS_REQUEST_READ_EXTERNAL); //applynewpermissionmodel public void onrequestpermissionsresult(int requestcode, String permissions[], int[] grantresults) { switch (requestcode) { case MY_PERMISSIONS_REQUEST_READ_EXTERNAL: { // If request is cancelled, the result arrays are empty. if (grantresults.length > 0 && grantresults[0] == PackageManager.PERMISSION_GRANTED) { // permission was granted - call oncreate again to setup any pending widgets oncreate(null); else { // permission denied return; ❻

39 //onrequestpermissionresult //Activity Environment getexternalstoragedirectory() storage/ emulated/0 Alarms, DCIM, Downloads Pictures icon.setimagedrawable(drawable.createfrompath()) drawable res/drawable/.setimagedrawable(drawable.createfrompath(largeimagefile.getabsolutepath())) applymarshmallowpermissionmodel if (ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) return; // request the permission to use SD card. ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, MY_PERMISSIONS_REQUEST_READ_EXTERNAL);

40 onrequestpermissionresult oncreate READ-EXTERNAL <?xml version="1.0" encoding="utf-8"?> <manifest package="matos.csu.a05_07_horizontalscroll" xmlns:android=" <uses-permission android:name="android.permission.read_external_storage" /> <application android:allowbackup="true" android:supportsrtl="true" <activity android:name=".mainactivity"> <intent-filter> <action android:name="android.intent.action.main"/> <category android:name="android.intent.category.launcher"/> </intent-filter> </activity> </application> </manifest> The ViewHolder Pattern getview() onvertview getview() View public View getview(int position, View convertview, ViewGroup parent) { convertview ListView scrapview scrapview

41 Row goes back to the screen Scroll Scrapviews (Rows previously inflated and shown, but currently out-of-focus) Row goes out of the screen Extending the BaseAdapter class BaseAdapter Views BaseAdapter SimpleCursorAdapter BaseAdapter ArrayAdapter CursorAdapter BaseAdapter getitem()

42 Table Mandatory BaseAdapter Abstract Methods int getcount() Object getitem(int position) long getitemid(int position) View getview(int position, View convertview, ViewGroup parent) Example 5.11 Extending BasedAdapter - Handling multiple row taps list_row_gui Database MainActivity CustomBaseAdapter activity_main

43 <LinearLayout xmlns:android=" xmlns:tools=" android:layout_height="match_parent" android:padding="16dp" android:orientation="vertical"> <ListView > </ListView> </LinearLayout> MainActivity ListView <LinearLayout xmlns:android=" xmlns:tools="

44 android:orientation="horizontal" android:padding="16dp" > <ImageView android:layout_width="50dp" android:layout_height="50dp" android:contentdescription="image_left" /> <LinearLayout android:layout_width="0dp" android:layout_marginleft="20dp" android:layout_weight="2" android:orientation="vertical" > <TextView android:layout_width="wrap_content" android:text="this is line 1" android:textappearance="?android:attr/textappearancelarge" /> <TextView android:layout_width="wrap_content" android:text="this is line 2" android:textappearance="?android:attr/textappearancesmall" /> </LinearLayout> <ImageView android:layout_width="50dp" android:layout_height="50dp" android:contentdescription="image_right" /> </LinearLayout> public class MainActivity extends AppCompatActivity { Database database_records; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); ListView listview = (ListView) findviewbyid(r.id.listview1); //create an instance of our fake database: {[text1, text2, icon] List database = new Database().dbList;

45 //create instance of our extended BaseAdapter CustomBaseAdapter adapter = new CustomBaseAdapter(this, database, R.layout.list_row_gui ); listview.setadapter(adapter); //oncreate MainActivty ListView public class CustomBaseAdapter extends BaseAdapter { //references to MainActivity's context, row layout, and data sources Context context; int layouttobeinflated; List<Database.DbRecord> dblist; //accept arguments, create a custom data adapter public CustomBaseAdapter(Context context, List<Database.DbRecord> databaselist, int resource) { this.context = context; this.dblist = databaselist; layouttobeinflated = resource; //return the number of rows held in the source list public int getcount() { return dblist.size(); ❶ //return database item representing row in given position public Database.DbRecord getitem(int position) { return dblist.get(position); //return the ID of item held in given position (our decision: ID same as position) public long getitemid(int position) { return position; //inflate row template, do plumbing, populate fields, add listener to right image //assign ID, return beautified row (applying ViewHolder strategy) public View getview(final int position, View convertview, ViewGroup parent) { ❷ // Use ViewHolder pattern to reduce calls to: inflate & findviewbyid. // Holder is a POJO for the GUI rows [textview1,textview2, img1, img2] MyViewHolder holder;

46 // hopefully convertview is a scrapview already made (but out of sight) View row = convertview; // has this row been already created? if (row == null) { // first time this row has to be made: (1) inflate custom layout // holding images and text, (2) invoke findviewbyid to access its // sub-components LayoutInflater inflater = ((Activity) context).getlayoutinflater(); row = inflater.inflate(layouttobeinflated, null); holder = new MyViewHolder(); // plumbing - provide access to each widget in the inflated layout // (two images & two lines of text) holder = new MyViewHolder(); holder.textview1 = (TextView) row.findviewbyid(r.id.rowtextview1); holder.textview2 = (TextView) row.findviewbyid(r.id.rowtextview2); holder.imageview1 = (ImageView) row.findviewbyid(r.id.rowimageview1); holder.imageview2 = (ImageView) row.findviewbyid(r.id.rowimageview2); // identify this row with the POJO holder just created row.settag(holder); row.setid(position); else { // row was already created- no need to inflate and invoke findviewbyid // gettag() returns the object originally stored in this view holder = (MyViewHolder) row.gettag(); // enter(or restore) data that goes in this frame (from database 'position') Database.DbRecord dbrec = getitem(position); holder.textview1.settext(dbrec.text1); holder.textview2.settext(dbrec.text2); holder.imageview1.setimageresource(dbrec.img1); holder.imageview2.setimageresource(r.mipmap.ic_pic_right); // EXTRA: individual listeners go here - if you need only a single // listener for the entire row, put it into ActivityMain. // This is a CLICK listener on top of the right icon (imageview2) ❸ // (for example, here you start an intent to call phone[position]) holder.imageview2.setonclicklistener(new View.OnClickListener() { public void onclick(view v) { Toast.makeText(context, "(RIGHT) IMAGE CLICKED - " + position, Toast.LENGTH_SHORT).show(); );

47 // row listener (user clicks on any other part of the row) ❹ row.setonclicklistener(new View.OnClickListener() { public void onclick(view v) { Toast.makeText(context, "ROW CLICKED - " + position, Toast.LENGTH_SHORT).show(); ); return row; // getview // A humble POJO holding references to GUI widgets that are part of rows ❺ // shown by the list. They have already been made and their IDs are known, // therefore there is no need to issue 'findviewbyid' calls again. public class MyViewHolder { TextView textview1; TextView textview2; ImageView imageview1; ImageView imageview2; // CustomMadeListener CustomBaseAdapter getcount() getitem(position) getitemid(position) getview getview() convertview row.findviewbyid()

48 Toast onclicklistener onclicklistener Toast public class Database { // TEST DATABASE public String[] text1array = { "Photo-00", "Photo-01", "Photo-02", "Photo-03", "Photo-04", "Photo-05", "Photo-06", "Photo-07", "Photo-08", "Photo-09", "Photo-10", "Photo-11", "Photo-12", "Photo-13", "Photo-14", "Photo-15", "Photo-16", "Photo-17", "Photo-18", "Photo-19", "Photo-20", "Photo-21", "Photo-22", "Photo-23", "Photo-24", "Photo-25", "Photo-26", ; public String[] text2array = { "Turtle", "Blossom", "Building", "Cat", "Church", "Coffee", "Coffee","Dubrovnik", "Egg", "Firefighters", "Flower", "Football","Isolated", "Jetty", "Jetty", "Paraglider", "Pelican","Pelican", "Pier", "Purpursonnen Hut", "Roofs", "South Africa","Stone Arch", "Sunset", "Tangerine", "Travel", "Tree" ; ❶ public Integer[] icon1array = { R.drawable.small_pic00,R.drawable.small_pic01, csu.matos.r.drawable.small_pic02, csu.matos.r.drawable.small_pic03, csu.matos.r.drawable.small_pic04, csu.matos.r.drawable.small_pic05, csu.matos.r.drawable.small_pic06, csu.matos.r.drawable.small_pic07, csu.matos.r.drawable.small_pic08, csu.matos.r.drawable.small_pic09, csu.matos.r.drawable.small_pic10, csu.matos.r.drawable.small_pic11, csu.matos.r.drawable.small_pic12, csu.matos.r.drawable.small_pic13, csu.matos.r.drawable.small_pic14, csu.matos.r.drawable.small_pic15, csu.matos.r.drawable.small_pic16, csu.matos.r.drawable.small_pic15, csu.matos.r.drawable.small_pic17, csu.matos.r.drawable.small_pic18, csu.matos.r.drawable.small_pic19, csu.matos.r.drawable.small_pic20, csu.matos.r.drawable.small_pic21, csu.matos.r.drawable.small_pic22, csu.matos.r.drawable.small_pic23, csu.matos.r.drawable.small_pic24, csu.matos.r.drawable.small_pic25, csu.matos.r.drawable.small_pic26,; public class DbRecord { public String text1; public String text2; public Integer img1; public DbRecord(String text1, String text2, Integer img1) { this.text1 = text1; this.text2 = text2;

49 this.img1 = img1; //dbrecord // dblist is a 'database' holding a list of DbRecods:[string,string,int] public ArrayList<DbRecord> dblist = new ArrayList<DbRecord>(); // populate the 'database' with data items ❷ public Database () { for(int i=0; i<text1array.length; i++){ dblist.add(new DbRecord(text1array[i], text2array[i], icon1array[i]) ); //Database Database Database ArrayList ArrayList<DbRecord> ListView

50

51

List-Based Widgets: Lists, Grids, and Scroll Views

List-Based Widgets: Lists, Grids, and Scroll Views Lesson 5 List-Based Widgets: Lists, Grids, and Scroll Views Victor Matos Cleveland State University Portions of this page are reproduced from work created and shared by Google and used according to terms

More information

Android List-Based Selection Widgets

Android List-Based Selection Widgets Lesson 6 Android List-Based Selection Widgets Notes are based on: Android Developers http://developer.android.com/index.html Victor Matos Cleveland State University Portions of this page are reproduced

More information

CS371m - Mobile Computing. Runtime Permissions

CS371m - Mobile Computing. Runtime Permissions CS371m - Mobile Computing Runtime Permissions Clicker If your app wants to access the users contacts when do you request permission to do this? A. Never, its not necessary B. At compile time C. At install

More information

Android Tutorial: Part 2

Android Tutorial: Part 2 Android Tutorial: Part 2 Creating a TCP/IP Client App Using the TCP Client Developed in this Course: Android OS Development Issues 1 Outline Permissions UI Thread UI Widget Access by External Thread Android

More information

Adapter.

Adapter. 1 Adapter An Adapter object acts as a bridge between an AdapterView and the underlying data for that view The Adapter provides access to the data items The Adapter is also responsible for making a View

More information

Android Layout Types

Android Layout Types Android Layout Types Android Linear Layout Android LinearLayout is a view group that aligns all children in either vertically or horizontally. android:divider - This is drawable to use as a vertical divider

More information

Practical 1.ListView example

Practical 1.ListView example Practical 1.ListView example In this example, we show you how to display a list of fruit name via ListView. Android Layout file File : res/layout/list_fruit.xml

More information

Graphical User Interfaces

Graphical User Interfaces Graphical User Interfaces Some suggestions Avoid displaying too many things Well-known anti-patterns Display useful content on your start screen Use action bars to provide consistent navigation Keep your

More information

Creating a Custom ListView

Creating a Custom ListView Creating a Custom ListView References https://developer.android.com/guide/topics/ui/declaring-layout.html#adapterviews Overview The ListView in the previous tutorial creates a TextView object for each

More information

Lampiran Program : Res - Layout Activity_main.xml

More information

Fragment Example Create the following files and test the application on emulator or device.

Fragment Example Create the following files and test the application on emulator or device. Fragment Example Create the following files and test the application on emulator or device. File: AndroidManifest.xml

More information

Adaptation of materials: dr Tomasz Xięski. Based on presentations made available by Victor Matos, Cleveland State University.

Adaptation of materials: dr Tomasz Xięski. Based on presentations made available by Victor Matos, Cleveland State University. Creating dialogs Adaptation of materials: dr Tomasz Xięski. Based on presentations made available by Victor Matos, Cleveland State University. Portions of this page are reproduced from work created and

More information

Introductory Mobile App Development

Introductory Mobile App Development Introductory Mobile App Development 152-160 Quick Links & Text References Overview Pages ListView Pages ArrayAdaper Pages Filling a ListView Pages Sensing Click Pages Selected Item Info Pages Configuring

More information

M.A.D ASSIGNMENT # 2 REHAN ASGHAR BSSE 15126

M.A.D ASSIGNMENT # 2 REHAN ASGHAR BSSE 15126 M.A.D ASSIGNMENT # 2 REHAN ASGHAR BSSE 15126 Submitted to: Sir Waqas Asghar MAY 23, 2017 SUBMITTED BY: REHAN ASGHAR Intent in Android What are Intent? An Intent is a messaging object you can use to request

More information

Agenda. Overview of Xamarin and Xamarin.Android Xamarin.Android fundamentals Creating a detail screen

Agenda. Overview of Xamarin and Xamarin.Android Xamarin.Android fundamentals Creating a detail screen Gill Cleeren Agenda Overview of Xamarin and Xamarin.Android Xamarin.Android fundamentals Creating a detail screen Lists and navigation Navigating from master to detail Optimizing the application Preparing

More information

ListView (link) An ordered collection of selectable choices. key attributes in XML:

ListView (link) An ordered collection of selectable choices. key attributes in XML: CS 193A Lists This document is copyright (C) Marty Stepp and Stanford Computer Science. Licensed under Creative Commons Attribution 2.5 License. All rights reserved. ListView (link) An ordered collection

More information

ListView Containers. Resources. Creating a ListView

ListView Containers. Resources. Creating a ListView ListView Containers Resources https://developer.android.com/guide/topics/ui/layout/listview.html https://developer.android.com/reference/android/widget/listview.html Creating a ListView A ListView is a

More information

Android CardView Tutorial

Android CardView Tutorial Android CardView Tutorial by Kapil - Wednesday, April 13, 2016 http://www.androidtutorialpoint.com/material-design/android-cardview-tutorial/ YouTube Video We have already discussed about RecyclerView

More information

1. Simple List. 1.1 Simple List using simple_list_item_1

1. Simple List. 1.1 Simple List using simple_list_item_1 1. Simple List 1.1 Simple List using simple_list_item_1 1. Create the Android application with the following attributes. Application Name: MySimpleList Project Name: Package Name: MySimpleList com.example.mysimplelist

More information

Android Apps Development for Mobile and Tablet Device (Level I) Lesson 4. Workshop

Android Apps Development for Mobile and Tablet Device (Level I) Lesson 4. Workshop Workshop 1. Create an Option Menu, and convert it into Action Bar (Page 1 8) Create an simple Option Menu Convert Option Menu into Action Bar Create Event Listener for Menu and Action Bar Add System Icon

More information

Android Specifics. Jonathan Diehl (Informatik 10) Hendrik Thüs (Informatik 9)

Android Specifics. Jonathan Diehl (Informatik 10) Hendrik Thüs (Informatik 9) Android Specifics Jonathan Diehl (Informatik 10) Hendrik Thüs (Informatik 9) Android Specifics ArrayAdapter Preferences Widgets Jonathan Diehl, Hendrik Thüs 2 ArrayAdapter Jonathan Diehl, Hendrik Thüs

More information

When programming in groups of people, it s essential to version the code. One of the most popular versioning tools is git. Some benefits of git are:

When programming in groups of people, it s essential to version the code. One of the most popular versioning tools is git. Some benefits of git are: ETSN05, Fall 2017, Version 1.0 Software Development of Large Systems Lab 2 preparations Read through this document carefully. In order to pass lab 2, you will need to understand the topics presented in

More information

Produced by. Mobile Application Development. Higher Diploma in Science in Computer Science. Eamonn de Leastar

Produced by. Mobile Application Development. Higher Diploma in Science in Computer Science. Eamonn de Leastar Mobile Application Development Higher Diploma in Science in Computer Science Produced by Eamonn de Leastar (edeleastar@wit.ie) Department of Computing, Maths & Physics Waterford Institute of Technology

More information

Produced by. Mobile Application Development. Higher Diploma in Science in Computer Science. Eamonn de Leastar

Produced by. Mobile Application Development. Higher Diploma in Science in Computer Science. Eamonn de Leastar Mobile Application Development Higher Diploma in Science in Computer Science Produced by Eamonn de Leastar (edeleastar@wit.ie) Department of Computing, Maths & Physics Waterford Institute of Technology

More information

Chapter 8 Positioning with Layouts

Chapter 8 Positioning with Layouts Introduction to Android Application Development, Android Essentials, Fifth Edition Chapter 8 Positioning with Layouts Chapter 8 Overview Create user interfaces in Android by defining resource files or

More information

Intents. Your first app assignment

Intents. Your first app assignment Intents Your first app assignment We will make this. Decidedly lackluster. Java Code Java Code XML XML Preview XML Java Code Java Code XML Buttons that work

More information

MAD ASSIGNMENT NO 3. Submitted by: Rehan Asghar BSSE AUGUST 25, SUBMITTED TO: SIR WAQAS ASGHAR Superior CS&IT Dept.

MAD ASSIGNMENT NO 3. Submitted by: Rehan Asghar BSSE AUGUST 25, SUBMITTED TO: SIR WAQAS ASGHAR Superior CS&IT Dept. MAD ASSIGNMENT NO 3 Submitted by: Rehan Asghar BSSE 7 15126 AUGUST 25, 2017 SUBMITTED TO: SIR WAQAS ASGHAR Superior CS&IT Dept. MainActivity.java File package com.example.tutorialspoint; import android.manifest;

More information

ActionBar. import android.support.v7.app.actionbaractivity; public class MyAppBarActivity extends ActionBarActivity { }

ActionBar. import android.support.v7.app.actionbaractivity; public class MyAppBarActivity extends ActionBarActivity { } Android ActionBar import android.support.v7.app.actionbaractivity; public class MyAppBarActivity extends ActionBarActivity { Layout, activity.xml

More information

Mobile Application Development Lab [] Simple Android Application for Native Calculator. To develop a Simple Android Application for Native Calculator.

Mobile Application Development Lab [] Simple Android Application for Native Calculator. To develop a Simple Android Application for Native Calculator. Simple Android Application for Native Calculator Aim: To develop a Simple Android Application for Native Calculator. Procedure: Creating a New project: Open Android Stdio and then click on File -> New

More information

Android UI Development

Android UI Development Android UI Development Android UI Studio Widget Layout Android UI 1 Building Applications A typical application will include: Activities - MainActivity as your entry point - Possibly other activities (corresponding

More information

Developing Android Applications Introduction to Software Engineering Fall Updated 1st November 2015

Developing Android Applications Introduction to Software Engineering Fall Updated 1st November 2015 Developing Android Applications Introduction to Software Engineering Fall 2015 Updated 1st November 2015 Android Lab 3 & Midterm Additional Concepts No Class Assignment 2 Class Plan Android : Additional

More information

Diving into Android. By Jeroen Tietema. Jeroen Tietema,

Diving into Android. By Jeroen Tietema. Jeroen Tietema, Diving into Android By Jeroen Tietema Jeroen Tietema, 2015 1 Requirements 4 Android SDK 1 4 Android Studio (or your IDE / editor of choice) 4 Emulator (Genymotion) or a real device. 1 See https://developer.android.com

More information

Accelerating Information Technology Innovation

Accelerating Information Technology Innovation Accelerating Information Technology Innovation http://aiti.mit.edu India Summer 2012 Review Session Android and Web Working with Views Working with Views Create a new Android project. The app name should

More information

CSE 660 Lab 3 Khoi Pham Thanh Ho April 19 th, 2015

CSE 660 Lab 3 Khoi Pham Thanh Ho April 19 th, 2015 CSE 660 Lab 3 Khoi Pham Thanh Ho April 19 th, 2015 Comment and Evaluation: This lab introduces us about Android SDK and how to write a program for Android platform. The calculator is pretty easy, everything

More information

Overview. Lecture: Implicit Calling via Share Implicit Receiving via Share Launch Telephone Launch Settings Homework

Overview. Lecture: Implicit Calling via Share Implicit Receiving via Share Launch Telephone Launch Settings Homework Implicit Intents Overview Lecture: Implicit Calling via Share Implicit Receiving via Share Launch Telephone Launch Settings Homework Intents Intent asynchronous message used to activate one Android component

More information

Chapter 7: Reveal! Displaying Pictures in a Gallery

Chapter 7: Reveal! Displaying Pictures in a Gallery Chapter 7: Reveal! Displaying Pictures in a Gallery Objectives In this chapter, you learn to: Create an Android project using a Gallery control Add a Gallery to display a horizontal list of images Reference

More information

GUI Widget. Lecture6

GUI Widget. Lecture6 GUI Widget Lecture6 AnalogClock/Digital Clock Button CheckBox DatePicker EditText Gallery ImageView/Button MapView ProgressBar RadioButton Spinner TextView TimePicker WebView Android Widgets Designing

More information

Mobile Programming Lecture 3. Resources, Selection, Activities, Intents

Mobile Programming Lecture 3. Resources, Selection, Activities, Intents Mobile Programming Lecture 3 Resources, Selection, Activities, Intents Lecture 2 Review What widget would you use to allow the user to enter a yes/no value a range of values from 1 to 100 What's the benefit

More information

LAMPIRAN PROGRAM. public class Listdata_adiktif extends ArrayAdapter<ModelData_adiktif> {

LAMPIRAN PROGRAM. public class Listdata_adiktif extends ArrayAdapter<ModelData_adiktif> { 1 LAMPIRAN PROGRAM JAVA Listdata_adiktif.java package com.example.win.api.adapter; import android.content.context; import android.support.annotation.nonnull; import android.view.layoutinflater; import

More information

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I)

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I) ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I) Lecture 3: Android Life Cycle and Permission Entire Lifetime An activity begins its lifecycle when entering the oncreate() state If not interrupted

More information

CSE 660 Lab 7. Submitted by: Arumugam Thendramil Pavai. 1)Simple Remote Calculator. Server is created using ServerSocket class of java. Server.

CSE 660 Lab 7. Submitted by: Arumugam Thendramil Pavai. 1)Simple Remote Calculator. Server is created using ServerSocket class of java. Server. CSE 660 Lab 7 Submitted by: Arumugam Thendramil Pavai 1)Simple Remote Calculator Server is created using ServerSocket class of java Server.java import java.io.ioexception; import java.net.serversocket;

More information

CS371m - Mobile Computing. User Interface Basics

CS371m - Mobile Computing. User Interface Basics CS371m - Mobile Computing User Interface Basics Clicker Question Have you ever implemented a Graphical User Interface (GUI) as part of a program? A. Yes, in another class. B. Yes, at a job or internship.

More information

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Managing Screen Orientation

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Managing Screen Orientation EMBEDDED SYSTEMS PROGRAMMING 2016-17 Application Tip: Managing Screen Orientation ORIENTATIONS Portrait Landscape Reverse portrait Reverse landscape ON REVERSE PORTRAIT Android: all four orientations are

More information

Lecture 14. Android Application Development

Lecture 14. Android Application Development Lecture 14 Android Application Development Notification Instructor Muhammad Owais muhammad.owais@riphah.edu.pk Cell: 03215500223 Notifications Used to notify user for events Three general forms of Notifications

More information

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Switching UIs

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Switching UIs EMBEDDED SYSTEMS PROGRAMMING 2015-16 Application Tip: Switching UIs THE PROBLEM How to switch from one UI to another Each UI is associated with a distinct class that controls it Solution shown: two UIs,

More information

Arrays of Buttons. Inside Android

Arrays of Buttons. Inside Android Arrays of Buttons Inside Android The Complete Code Listing. Be careful about cutting and pasting.

More information

Adapting to Data. Before we get to the fun stuff... Initial setup

Adapting to Data. Before we get to the fun stuff... Initial setup Adapting to Data So far, we've mostly been sticking with a recurring theme: visual elements are tied to XML-defined resources, not programmatic creation or management. But that won't always be the case.

More information

Basic GUI elements - exercises

Basic GUI elements - exercises Basic GUI elements - exercises https://developer.android.com/studio/index.html LIVE DEMO Please create a simple application, which will be used to calculate the area of basic geometric figures. To add

More information

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I)

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I) ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I) Lecture 3: Android Life Cycle and Permission Android Lifecycle An activity begins its lifecycle when entering the oncreate() state If not

More information

INTRODUCTION COS MOBILE DEVELOPMENT WHAT IS ANDROID CORE OS. 6-Android Basics.key - February 21, Linux-based.

INTRODUCTION COS MOBILE DEVELOPMENT WHAT IS ANDROID CORE OS. 6-Android Basics.key - February 21, Linux-based. 1 COS 470 - MOBILE DEVELOPMENT INTRODUCTION 2 WHAT IS ANDROID Linux-based Java/Kotlin Android Runtime (ART) System Apps SMS, Calendar, etc. Platform Architecture 3 CORE OS Linux (64 bit) Each app is a

More information

Android UI: Overview

Android UI: Overview 1 Android UI: Overview An Activity is the front end component and it can contain screens. Android screens are composed of components or screen containers and components within the containers Screen containers

More information

Android Workshop: Model View Controller ( MVC):

Android Workshop: Model View Controller ( MVC): Android Workshop: Android Details: Android is framework that provides java programmers the ability to control different aspects of smart devices. This interaction happens through the Android SDK (Software

More information

Notification mechanism

Notification mechanism Notification mechanism Adaptation of materials: dr Tomasz Xięski. Based on presentations made available by Victor Matos, Cleveland State University. Portions of this page are reproduced from work created

More information

10.1 Introduction. Higher Level Processing. Word Recogniton Model. Text Output. Voice Signals. Spoken Words. Syntax, Semantics, Pragmatics

10.1 Introduction. Higher Level Processing. Word Recogniton Model. Text Output. Voice Signals. Spoken Words. Syntax, Semantics, Pragmatics Chapter 10 Speech Recognition 10.1 Introduction Speech recognition (SR) by machine, which translates spoken words into text has been a goal of research for more than six decades. It is also known as automatic

More information

Developing Android Applications

Developing Android Applications Developing Android Applications SEG2105 - Introduction to Software Engineering Fall 2016 Presented by: Felipe M. Modesto TA & PhD Candidate Faculty of Engineering Faculté de Génie uottawa.ca Additional

More information

Mobila applikationer och trådlösa nät, HI1033, HT2013

Mobila applikationer och trådlösa nät, HI1033, HT2013 Mobila applikationer och trådlösa nät, HI1033, HT2013 Today: - User Interface basics - View components - Event driven applications and callbacks - Menu and Context Menu - ListView and Adapters - Android

More information

Produced by. Mobile Application Development. David Drohan Department of Computing & Mathematics Waterford Institute of Technology

Produced by. Mobile Application Development. David Drohan Department of Computing & Mathematics Waterford Institute of Technology Mobile Application Development Produced by David Drohan (ddrohan@wit.ie) Department of Computing & Mathematics Waterford Institute of Technology http://www.wit.ie User Interface Design" & Development -

More information

Create a local SQL database hosting a CUSTOMER table. Each customer includes [id, name, phone]. Do the work inside Threads and Asynctasks.

Create a local SQL database hosting a CUSTOMER table. Each customer includes [id, name, phone]. Do the work inside Threads and Asynctasks. CIS 470 Lesson 13 Databases - Quick Notes Create a local SQL database hosting a CUSTOMER table. Each customer includes [id, name, phone]. Do the work inside Threads and Asynctasks. package csu.matos; import

More information

Software Practice 3 Before we start Today s lecture Today s Task Team organization

Software Practice 3 Before we start Today s lecture Today s Task Team organization 1 Software Practice 3 Before we start Today s lecture Today s Task Team organization Prof. Hwansoo Han T.A. Jeonghwan Park 43 2 Lecture Schedule Spring 2017 (Monday) This schedule can be changed M A R

More information

EECS 4443 Mobile User Interfaces. More About Layouts. Scott MacKenzie. York University. Overview (Review)

EECS 4443 Mobile User Interfaces. More About Layouts. Scott MacKenzie. York University. Overview (Review) EECS 4443 Mobile User Interfaces More About Layouts Scott MacKenzie York University Overview (Review) A layout defines the visual structure for a user interface, such as the UI for an activity or app widget

More information

Android writing files to the external storage device

Android writing files to the external storage device Android writing files to the external storage device The external storage area is what Android knows as the SD card. There is a virtual SD card within the Android file system although this may be of size

More information

Android Apps Development for Mobile and Tablet Device (Level I) Lesson 2

Android Apps Development for Mobile and Tablet Device (Level I) Lesson 2 Workshop 1. Compare different layout by using Change Layout button (Page 1 5) Relative Layout Linear Layout (Horizontal) Linear Layout (Vertical) Frame Layout 2. Revision on basic programming skill - control

More information

Mobila applikationer och trådlösa nät, HI1033, HT2012

Mobila applikationer och trådlösa nät, HI1033, HT2012 Mobila applikationer och trådlösa nät, HI1033, HT2012 Today: - User Interface basics - View components - Event driven applications and callbacks - Menu and Context Menu - ListView and Adapters - Android

More information

Mobile Computing Practice # 2a Android Applications - Interface

Mobile Computing Practice # 2a Android Applications - Interface Mobile Computing Practice # 2a Android Applications - Interface 1. Create an Android Lunch Places List application that allows the user to take note of restaurant characteristics like its name, address

More information

Programming with Android: Introduction. Layouts. Dipartimento di Informatica: Scienza e Ingegneria Università di Bologna

Programming with Android: Introduction. Layouts. Dipartimento di Informatica: Scienza e Ingegneria Università di Bologna Programming with Android: Introduction Layouts Luca Bedogni Marco Di Felice Dipartimento di Informatica: Scienza e Ingegneria Università di Bologna Views: outline Main difference between a Drawable and

More information

Fragments. Lecture 11

Fragments. Lecture 11 Fragments Lecture 11 Situational layouts Your app can use different layouts in different situations Different device type (tablet vs. phone vs. watch) Different screen size Different orientation (portrait

More information

Produced by. Mobile Application Development. David Drohan Department of Computing & Mathematics Waterford Institute of Technology

Produced by. Mobile Application Development. David Drohan Department of Computing & Mathematics Waterford Institute of Technology Mobile Application Development Produced by David Drohan (ddrohan@wit.ie) Department of Computing & Mathematics Waterford Institute of Technology http://www.wit.ie The image cannot be displayed. Your computer

More information

Statistics http://www.statista.com/topics/840/smartphones/ http://www.statista.com/topics/876/android/ http://www.statista.com/statistics/271774/share-of-android-platforms-on-mobile-devices-with-android-os/

More information

EECS 4443 Mobile User Interfaces. More About Layouts. Scott MacKenzie. York University

EECS 4443 Mobile User Interfaces. More About Layouts. Scott MacKenzie. York University EECS 4443 Mobile User Interfaces More About Layouts Scott MacKenzie York University Overview (Review) A layout defines the visual structure for a user interface, such as the UI for an activity or app widget

More information

MVC Apps Basic Widget Lifecycle Logging Debugging Dialogs

MVC Apps Basic Widget Lifecycle Logging Debugging Dialogs Overview MVC Apps Basic Widget Lifecycle Logging Debugging Dialogs Lecture: MVC Model View Controller What is an App? Android Activity Lifecycle Android Debugging Fixing Rotations & Landscape Layouts Localization

More information

Action Bar. Action bar: Top navigation bar at each screen The action bar is split into four different functional areas that apply to most apps.

Action Bar. Action bar: Top navigation bar at each screen The action bar is split into four different functional areas that apply to most apps. 1 Action Bar Action bar: Top navigation bar at each screen The action bar is split into four different functional areas that apply to most apps. 1) App Icon 3) Action Buttons 2)View Control 4) Action Overflows

More information

Android Basics. Android UI Architecture. Android UI 1

Android Basics. Android UI Architecture. Android UI 1 Android Basics Android UI Architecture Android UI 1 Android Design Constraints Limited resources like memory, processing, battery à Android stops your app when not in use Primarily touch interaction à

More information

MAD ASSIGNMENT NO 2. Submitted by: Rehan Asghar BSSE AUGUST 25, SUBMITTED TO: SIR WAQAS ASGHAR Superior CS&IT Dept.

MAD ASSIGNMENT NO 2. Submitted by: Rehan Asghar BSSE AUGUST 25, SUBMITTED TO: SIR WAQAS ASGHAR Superior CS&IT Dept. MAD ASSIGNMENT NO 2 Submitted by: Rehan Asghar BSSE 7 15126 AUGUST 25, 2017 SUBMITTED TO: SIR WAQAS ASGHAR Superior CS&IT Dept. Android Widgets There are given a lot of android widgets with simplified

More information

05. RecyclerView and Styles

05. RecyclerView and Styles 05. RecyclerView and Styles 08.03.2018 1 Agenda Intents Creating Lists with RecyclerView Creating Cards with CardView Application Bar Menu Styles and Themes 2 Intents 3 What is Intent? An Intent is an

More information

Building User Interface for Android Mobile Applications II

Building User Interface for Android Mobile Applications II Building User Interface for Android Mobile Applications II Mobile App Development 1 MVC 2 MVC 1 MVC 2 MVC Android redraw View invalidate Controller tap, key pressed update Model MVC MVC in Android View

More information

PENGEMBANGAN APLIKASI PERANGKAT BERGERAK (MOBILE)

PENGEMBANGAN APLIKASI PERANGKAT BERGERAK (MOBILE) PENGEMBANGAN APLIKASI PERANGKAT BERGERAK (MOBILE) Network Connection Web Service K Candra Brata andra.course@gmail.com Mobille App Lab 2015-2016 Network Connection http://developer.android.com/training/basics/network-ops/connecting.html

More information

Produced by. Mobile Application Development. Higher Diploma in Science in Computer Science. Eamonn de Leastar

Produced by. Mobile Application Development. Higher Diploma in Science in Computer Science. Eamonn de Leastar Mobile Application Development Higher Diploma in Science in Computer Science Produced by Eamonn de Leastar (edeleastar@wit.ie) Department of Computing, Maths & Physics Waterford Institute of Technology

More information

TextView Control. EditText Control. TextView Attributes. android:id - This is the ID which uniquely identifies the control.

TextView Control. EditText Control. TextView Attributes. android:id - This is the ID which uniquely identifies the control. A TextView displays text to the user. TextView Attributes TextView Control android:id - This is the ID which uniquely identifies the control. android:capitalize - If set, specifies that this TextView has

More information

EMBEDDED SYSTEMS PROGRAMMING Android Services

EMBEDDED SYSTEMS PROGRAMMING Android Services EMBEDDED SYSTEMS PROGRAMMING 2016-17 Android Services APP COMPONENTS Activity: a single screen with a user interface Broadcast receiver: responds to system-wide broadcast events. No user interface Service:

More information

Hello World. Lesson 1. Android Developer Fundamentals. Android Developer Fundamentals. Layouts, and. NonCommercial

Hello World. Lesson 1. Android Developer Fundamentals. Android Developer Fundamentals. Layouts, and. NonCommercial Hello World Lesson 1 This work is licensed This under work a Creative is is licensed Commons under a a Attribution-NonCommercial Creative 4.0 Commons International Attribution- License 1 NonCommercial

More information

ANDROID USER INTERFACE

ANDROID USER INTERFACE 1 ANDROID USER INTERFACE Views FUNDAMENTAL UI DESIGN Visual interface element (controls or widgets) ViewGroup Contains multiple widgets. Layouts inherit the ViewGroup class Activities Screen being displayed

More information

Chapter 5 Flashing Neon FrameLayout

Chapter 5 Flashing Neon FrameLayout 5.1 Case Overview This case mainly introduced the usages of FrameLayout; we can use FrameLayout to realize the effect, the superposition of multiple widgets. This example is combined with Timer and Handler

More information

TextView. A label is called a TextView. TextViews are typically used to display a caption TextViews are not editable, therefore they take no input

TextView. A label is called a TextView. TextViews are typically used to display a caption TextViews are not editable, therefore they take no input 1 UI Components 2 UI Components 3 A label is called a TextView. TextView TextViews are typically used to display a caption TextViews are not editable, therefore they take no input - - - - - - -

More information

User Interface Development in Android Applications

User Interface Development in Android Applications ITU- FAO- DOA- TRCSL Training on Innovation & Application Development for E- Agriculture User Interface Development in Android Applications 11 th - 15 th December 2017 Peradeniya, Sri Lanka Shahryar Khan

More information

Mobile Computing Practice # 2c Android Applications - Interface

Mobile Computing Practice # 2c Android Applications - Interface Mobile Computing Practice # 2c Android Applications - Interface One more step in the restaurants application. 1. Design an alternative layout for showing up in landscape mode. Our current layout is not

More information

ANDROID APPS DEVELOPMENT FOR MOBILE GAME

ANDROID APPS DEVELOPMENT FOR MOBILE GAME ANDROID APPS DEVELOPMENT FOR MOBILE GAME Application Components Hold the content of a message (E.g. convey a request for an activity to present an image) Lecture 2: Android Layout and Permission Present

More information

AGL Application Framework - Privileges Management

AGL Application Framework - Privileges Management AGL Application Framework - Privileges Management Version 2.0 September 2016 Abstract In AGL, as in many other embedded systems, different security mechanisms are settled in the core layers to ensure isolation

More information

The World of List View. Romain Guy and Adam Powell May 19, 2010

The World of List View. Romain Guy and Adam Powell May 19, 2010 The World of List View Romain Guy and Adam Powell May 19, 2010 View live notes and ask questions about this session on Wave http://bit.ly/9zozbr Agenda Virtualization and adapters Item properties Headers

More information

INTRODUCTION TO ANDROID

INTRODUCTION TO ANDROID INTRODUCTION TO ANDROID 1 Niv Voskoboynik Ben-Gurion University Electrical and Computer Engineering Advanced computer lab 2015 2 Contents Introduction Prior learning Download and install Thread Android

More information

Text Properties Data Validation Styles/Themes Material Design

Text Properties Data Validation Styles/Themes Material Design Text Properties Data Validation Styles/Themes Material Design Sisoft Technologies Pvt Ltd SRC E7, Shipra Riviera Bazar, Gyan Khand-3, Indirapuram, Ghaziabad Website: Email:info@sisoft.in Phone: +91-9999-283-283

More information

<uses-permission android:name="android.permission.internet"/>

<uses-permission android:name=android.permission.internet/> Chapter 11 Playing Video 11.1 Introduction We have discussed how to play audio in Chapter 9 using the class MediaPlayer. This class can also play video clips. In fact, the Android multimedia framework

More information

EMBEDDED SYSTEMS PROGRAMMING Application Basics

EMBEDDED SYSTEMS PROGRAMMING Application Basics EMBEDDED SYSTEMS PROGRAMMING 2015-16 Application Basics APPLICATIONS Application components (e.g., UI elements) are objects instantiated from the platform s frameworks Applications are event driven ( there

More information

Android Application Model I

Android Application Model I Android Application Model I CSE 5236: Mobile Application Development Instructor: Adam C. Champion, Ph.D. Course Coordinator: Dr. Rajiv Ramnath Reading: Big Nerd Ranch Guide, Chapters 3, 5 (Activities);

More information

Mobile Application Development

Mobile Application Development Mobile Application Development donation-web api { method: 'GET', path: '/api/candidates', config: CandidatesApi.find, { method: 'GET', path: '/api/candidates/{id', config: CandidatesApi.findOne, { method:

More information

Android Application Model I. CSE 5236: Mobile Application Development Instructor: Adam C. Champion, Ph.D. Course Coordinator: Dr.

Android Application Model I. CSE 5236: Mobile Application Development Instructor: Adam C. Champion, Ph.D. Course Coordinator: Dr. Android Application Model I CSE 5236: Mobile Application Development Instructor: Adam C. Champion, Ph.D. Course Coordinator: Dr. Rajiv Ramnath 1 Framework Support (e.g. Android) 2 Framework Capabilities

More information

Java & Android. Java Fundamentals. Madis Pink 2016 Tartu

Java & Android. Java Fundamentals. Madis Pink 2016 Tartu Java & Android Java Fundamentals Madis Pink 2016 Tartu 1 Agenda» Brief background intro to Android» Android app basics:» Activities & Intents» Resources» GUI» Tools 2 Android» A Linux-based Operating System»

More information

Tabel mysql. Kode di PHP. Config.php. Service.php

Tabel mysql. Kode di PHP. Config.php. Service.php Tabel mysql Kode di PHP Config.php Service.php Layout Kode di Main Activity package com.example.mini.webandroid; import android.app.progressdialog; import android.os.asynctask; import android.support.v7.app.appcompatactivity;

More information

Sizing and Positioning

Sizing and Positioning CS 193A Layout This document is copyright (C) Marty Stepp and Stanford Computer Science. Licensed under Creative Commons Attribution 2.5 License. All rights reserved. Sizing and Positioning How does the

More information