Android Hide Title Bar Example. Android Screen Orientation Example
|
|
- Piers Cameron
- 6 years ago
- Views:
Transcription
1 igap Technologies 1 if(!activitycompat.shouldshowrequestpermissionrationale(this, Manifest.permission.READ_CONTACTS)) { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_CONTACTS, 1); Android Hide Title Bar Example protected void oncreate(bundle savedinstancestate) { requestwindowfeature(window.feature_no_title); //code that displays the content in full screen mode this.getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, WindowManager.LayoutParams.FLAG_FULLSCREEN);//int flag, int mask Android Screen Orientation Example <activity android:name="com.example.screenorientation.mainactivity" android:label="@string/app_name" android:screenorientation="landscape"> Android ToggleButton Example public class MainActivity extends Activity { private ToggleButton togglebutton1, togglebutton2; private Button buttonsubmit; protected void oncreate(bundle savedinstancestate) {
2 igap Technologies 2 addlisteneronbuttonclick(); public void addlisteneronbuttonclick(){ //Getting the ToggleButton and Button instance from the layout xml file togglebutton1=(togglebutton)findviewbyid(r.id.togglebutton1); togglebutton2=(togglebutton)findviewbyid(r.id.togglebutton2); buttonsubmit=(button)findviewbyid(r.id.button1); //Performing action on button click buttonsubmit.setonclicklistener(new OnClickListener(){ public void onclick(view view) { StringBuilder result = new StringBuilder(); result.append("togglebutton1 : ").append(togglebutton1.gettext()); result.append("\ntogglebutton2 : ").append(togglebutton2.gettext()); //Displaying the message in toast Toast.makeText(getApplicationContext(), result.tostring(),toast.length_long). show(); ); public boolean oncreateoptionsmenu(menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getmenuinflater().inflate(r.menu.activity_main, menu); return true; Android CheckBox Example public class MainActivity extends Activity { CheckBox pizza,coffe,burger; Button buttonorder;
3 igap Technologies 3 protected void oncreate(bundle savedinstancestate) { addlisteneronbuttonclick(); public void addlisteneronbuttonclick(){ //Getting instance of CheckBoxes and Button from the activty_main.xml file pizza=(checkbox)findviewbyid(r.id.checkbox1); coffe=(checkbox)findviewbyid(r.id.checkbox2); burger=(checkbox)findviewbyid(r.id.checkbox3); buttonorder=(button)findviewbyid(r.id.button1); //Applying the Listener on the Button click buttonorder.setonclicklistener(new OnClickListener(){ public void onclick(view view) { int totalamount=0; StringBuilder result=new StringBuilder(); result.append("selected Items:"); if(pizza.ischecked()){ result.append("\npizza 100Rs"); totalamount+=100; if(coffe.ischecked()){ result.append("\ncoffe 50Rs"); totalamount+=50; if(burger.ischecked()){ result.append("\nburger 120Rs"); totalamount+=120; result.append("\ntotal: "+totalamount+"rs"); //Displaying the message on the toast Toast.makeText(getApplicationContext(), result.tostring(), Toast.LENGTH_LONG).sh ow(); );
4 igap Technologies 4 public boolean oncreateoptionsmenu(menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getmenuinflater().inflate(r.menu.activity_main, menu); return true; Android AlertDialog Example public class MainActivity extends Activity { protected void oncreate(bundle savedinstancestate) { AlertDialog.Builder builder = new AlertDialog.Builder(this); //Uncomment the below code to Set the message and title from the strings.xml file //builder.setmessage(r.string.dialog_message).settitle(r.string.dialog_title); //Setting message manually and performing action on button click builder.setmessage("do you want to close this application?").setcancelable(false).setpositivebutton("yes", new DialogInterface.OnClickListener() { public void onclick(dialoginterface dialog, int id) { finish(); ).setnegativebutton("no", new DialogInterface.OnClickListener() { public void onclick(dialoginterface dialog, int id) { // Action for 'NO' Button dialog.cancel(); ); //Creating dialog box AlertDialog alert = builder.create();
5 igap Technologies 5 //Setting the title manually alert.settitle("alertdialogexample"); alert.show(); public boolean oncreateoptionsmenu(menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getmenuinflater().inflate(r.menu.activity_main, menu); return true; next prev Android Spinner Example public class MainActivity extends Activity implements AdapterView.OnItemSelectedListener { String[] country = { "India", "USA", "China", "Japan", "Other", ; protected void oncreate(bundle savedinstancestate) { //Getting the instance of Spinner and applying OnItemSelectedListener on it Spinner spin = (Spinner) findviewbyid(r.id.spinner1); spin.setonitemselectedlistener(this); try); //Creating the ArrayAdapter instance having the country list ArrayAdapter aa = new ArrayAdapter(this,android.R.layout.simple_spinner_item,coun aa.setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item); //Setting the ArrayAdapter data on the Spinner spin.setadapter(aa);
6 igap Technologies 6 //Performing action onitemselected and onnothing selected public void onitemselected(adapterview<?> arg0, View arg1, int position,long id) { Toast.makeText(getApplicationContext(),country[position],Toast.LENGTH_LONG).sho w(); public void onnothingselected(adapterview<?> arg0) { // TODO Auto-generated method stub public boolean oncreateoptionsmenu(menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getmenuinflater().inflate(r.menu.activity_main, menu); return true; Android ListView File: activity_main.xml <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.constraintlayout xmlns:android=" xmlns:app=" xmlns:tools=" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="listview.example.com.listview.mainactivity"> <ListView android:id="@+id/listview" android:layout_width="match_parent" android:layout_height="fill_parent"
7 igap Technologies 7 /> </android.support.constraint.constraintlayout> mylist.xml File: mylist.xml <?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android=" android:id="@+id/textview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="medium Text" android:textstyle="bold" android:textappearance="?android:attr/textappearancemedium" android:layout_marginleft="10dp" android:layout_margintop="5dp" android:padding="2dp" android:textcolor="#4d4d4d" /> File:strings.xml <resources> <string name="app_name">listview</string> <string-array name="array_technology"> <item>android</item> <item>java</item> <item>php</item> <item>hadoop</item> <item>sap</item> <item>python</item> <item>ajax</item> <item>c++</item> <item>ruby</item> <item>rails</item> <item>.net</item> <item>perl</item> </string-array> </resources>
8 igap Technologies 8 File: MainActivity.java package listview.example.com.listview; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.view.view; import android.widget.adapterview; import android.widget.arrayadapter; import android.widget.listview; import android.widget.textview; import android.widget.toast; public class MainActivity extends AppCompatActivity { ListView listview; TextView textview; String[] listitem; protected void oncreate(bundle savedinstancestate) { listview=(listview)findviewbyid(r.id.listview); textview=(textview)findviewbyid(r.id.textview); listitem = getresources().getstringarray(r.array.array_technology); final ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.r.layout.simple_list_item_1, android.r.id.text1, listitem); listview.setadapter(adapter); listview.setonitemclicklistener(new AdapterView.OnItemClickListener() { public void onitemclick(adapterview<?> adapterview, View view, int position, lon g l) { // TODO Auto-generated method stub String value=adapter.getitem(position); Toast.makeText(getApplicationContext(),value,Toast.LENGTH_SHORT).show(); );
9 igap Technologies 9 Android RatingBar Example public class MainActivity extends Activity { RatingBar ratingbar1; Button button; protected void oncreate(bundle savedinstancestate) { addlisteneronbuttonclick(); public void addlisteneronbuttonclick(){ ratingbar1=(ratingbar)findviewbyid(r.id.ratingbar1); button=(button)findviewbyid(r.id.button1); //Performing action on Button Click button.setonclicklistener(new OnClickListener(){ public void onclick(view arg0) { //Getting the rating and displaying it on the toast String rating=string.valueof(ratingbar1.getrating()); Toast.makeText(getApplicationContext(), rating, Toast.LENGTH_LONG).show(); ); public boolean oncreateoptionsmenu(menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getmenuinflater().inflate(r.menu.activity_main, menu); return true; Android SeekBar Example
10 igap Technologies 10 public class MainActivity extends Activity implements OnSeekBarChangeListener{ SeekBar seekbar1; protected void oncreate(bundle savedinstancestate) { seekbar1=(seekbar)findviewbyid(r.id.seekbar1); seekbar1.setonseekbarchangelistener(this); public void onprogresschanged(seekbar seekbar, int progress, boolean fromuser) { Toast.makeText(getApplicationContext(),"seekbar progress: "+progress, Toast.LENGT H_SHORT).show(); public void onstarttrackingtouch(seekbar seekbar) { Toast.makeText(getApplicationContext(),"seekbar touch started!", Toast.LENGTH_SHO RT).show(); public void onstoptrackingtouch(seekbar seekbar) { Toast.makeText(getApplicationContext(),"seekbar touch stopped!", Toast.LENGTH_SH ORT).show(); public boolean oncreateoptionsmenu(menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getmenuinflater().inflate(r.menu.main, menu); return true; Android DatePicker Example public class MainActivity extends Activity { DatePicker picker;
11 igap Technologies 11 Button displaydate; TextView textview1; protected void oncreate(bundle savedinstancestate) { textview1=(textview)findviewbyid(r.id.textview1); picker=(datepicker)findviewbyid(r.id.datepicker1); displaydate=(button)findviewbyid(r.id.button1); textview1.settext(getcurrentdate()); displaydate.setonclicklistener(new OnClickListener(){ public void onclick(view view) { textview1.settext(getcurrentdate()); ); public String getcurrentdate(){ StringBuilder builder=new StringBuilder(); builder.append("current Date: "); builder.append((picker.getmonth() + 1)+"/");//month is 0 based builder.append(picker.getdayofmonth()+"/"); builder.append(picker.getyear()); return builder.tostring(); public boolean oncreateoptionsmenu(menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getmenuinflater().inflate(r.menu.activity_main, menu); return true; Android TimePicker Example
12 igap Technologies 12 public class MainActivity extends Activity { TextView textview1; TimePicker timepicker1; Button changetime; protected void oncreate(bundle savedinstancestate) { textview1=(textview)findviewbyid(r.id.textview1); timepicker1=(timepicker)findviewbyid(r.id.timepicker1); //Uncomment the below line of code for 24 hour view timepicker1.setis24hourview(true); changetime=(button)findviewbyid(r.id.button1); textview1.settext(getcurrenttime()); changetime.setonclicklistener(new OnClickListener(){ public void onclick(view view) { textview1.settext(getcurrenttime()); ); public String getcurrenttime(){ String currenttime="current Time: "+timepicker1.getcurrenthour()+":"+timepicker1. getcurrentminute(); return currenttime; public boolean oncreateoptionsmenu(menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getmenuinflater().inflate(r.menu.activity_main, menu); return true;
13 igap Technologies 13 Android Image Slider File: activity_main.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android=" xmlns:tools=" android:layout_width="fill_parent" android:layout_height="fill_parent" tools:context="com.example.test.imageslider.mainactivity"> <android.support.v4.view.viewpager android:layout_width="fill_parent" android:layout_height="fill_parent" /> </RelativeLayout> File: MainActivity.java package com.example.test.imageslider; import android.support.v4.view.viewpager; import android.support.v7.app.appcompatactivity; import android.os.bundle; public class MainActivity extends AppCompatActivity { protected void oncreate(bundle savedinstancestate) { ViewPager mviewpager = (ViewPager) findviewbyid(r.id.viewpage); ImageAdapter adapterview = new ImageAdapter(this); mviewpager.setadapter(adapterview);
14 igap Technologies 14 ImageAdapter class Now create ImageAdapter class which extends PagerAdapter for android image slider. Place some images in drawable folder which are to be slid. File: ImageAdapter.java package com.example.test.imageslider; import android.content.context; import android.support.v4.view.pageradapter; import android.support.v4.view.viewpager; import android.view.view; import android.view.viewgroup; import android.widget.imageview; public class ImageAdapter extends PagerAdapter{ Context mcontext; ImageAdapter(Context context) { this.mcontext = context; public boolean isviewfromobject(view view, Object object) { return view == ((ImageView) object); private int[] sliderimageid = new int[]{ R.drawable.image1, R.drawable.image2, R.drawable.image3,R.drawable.image4, R. drawable.image5, ; public Object instantiateitem(viewgroup container, int position) { ImageView imageview = new ImageView(mContext); imageview.setscaletype(imageview.scaletype.center_crop); imageview.setimageresource(sliderimageid[position]);
15 igap Technologies 15 ((ViewPager) container).addview(imageview, 0); return imageview; public void destroyitem(viewgroup container, int position, Object object) { ((ViewPager) container).removeview((imageview) object); public int getcount() { return sliderimageid.length; Android Share App Data (ACTION_SEND) public class MainActivity extends AppCompatActivity { Button sharebutton; protected void oncreate(bundle savedinstancestate) { sharebutton=(button)findviewbyid(r.id.button); sharebutton.setonclicklistener(new View.OnClickListener() { public void onclick(view v) { Intent shareintent = new Intent(android.content.Intent.ACTION_SEND); shareintent.settype("text/plain"); shareintent.putextra(intent.extra_subject,"insert Subject here"); String app_url = " vatpoint"; shareintent.putextra(android.content.intent.extra_text,app_url); startactivity(intent.createchooser(shareintent, "Share via")); );
16 igap Technologies 16 Android Option Menu Example menu_main.xml It contains three items as show below. It is created automatically inside the res/menu directory. File: menu_main.xml <menu xmlns:androclass=" > <item android:title="item 1"/> <item android:title="item 2"/> <item android:title="item 3"/> </menu> File: MainActivity.java package com.javatpoint.optionmenu; import android.os.bundle; import android.app.activity; import android.view.menu; import android.view.menuitem; import android.widget.toast; public class MainActivity extends Activity { protected void oncreate(bundle savedinstancestate) { public boolean oncreateoptionsmenu(menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getmenuinflater().inflate(r.menu.main, menu);//menu Resource, Menu return true; public boolean onoptionsitemselected(menuitem item) { show(); switch (item.getitemid()) { case R.id.item1: Toast.makeText(getApplicationContext(),"Item 1 Selected",Toast.LENGTH_LONG).
17 igap Technologies 17 return true; case R.id.item2: Toast.makeText(getApplicationContext(),"Item 2 Selected",Toast.LENGTH_LONG).show(); return true; case R.id.item3: Toast.makeText(getApplicationContext(),"Item 3 Selected",Toast.LENGTH_LONG).show(); return true; default: return super.onoptionsitemselected(item); Android Context Menu Example File: MainActivity.java package com.javatpoint.contextmenu; import android.os.bundle; import android.app.activity; import android.view.contextmenu; import android.view.contextmenu.contextmenuinfo; import android.view.menu; import android.view.menuitem; import android.view.view; import android.widget.adapterview; import android.widget.arrayadapter; import android.widget.listview; import android.widget.toast; public class MainActivity extends Activity { ListView listview1; String contacts[]={"ajay","sachin","sumit","tarun","yogesh"; protected void oncreate(bundle savedinstancestate) {
18 igap Technologies 18 listview1=(listview)findviewbyid(r.id.listview1); ArrayAdapter<String> adapter=new ArrayAdapter<String>(this,android.R.layout.sim ple_list_item_1,contacts); listview1.setadapter(adapter); // Register the ListView for Context menu registerforcontextmenu(listview1); public void oncreatecontextmenu(contextmenu menu, View v, ContextMenuInfo menuin fo) { super.oncreatecontextmenu(menu, v, menuinfo); menu.setheadertitle("select The Action"); menu.add(0, v.getid(), 0, "Call");//groupId, itemid, order, title menu.add(0, v.getid(), 0, "SMS"); public boolean oncontextitemselected(menuitem item){ if(item.gettitle()=="call"){ Toast.makeText(getApplicationContext(),"calling code",toast.length_long).sho w(); else if(item.gettitle()=="sms"){ Toast.makeText(getApplicationContext(),"sending sms code",toast.length_lon G).show(); else{ return false; return true;
19 igap Technologies 19 Android Internal Storage Example Activity class Let's write the code to write and read data from the internal storage. File: MainActivity.java package com.example.internalstorage; import java.io.bufferedreader; import java.io.fileinputstream; import java.io.filenotfoundexception; import java.io.fileoutputstream; import java.io.ioexception; import java.io.inputstreamreader; import android.os.bundle; import android.app.activity; import android.content.context; import android.view.menu; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.edittext; import android.widget.toast; public class MainActivity extends Activity { EditText edittextfilename,edittextdata;
20 igap Technologies 20 Button savebutton,readbutton; protected void oncreate(bundle savedinstancestate) { edittextfilename=(edittext)findviewbyid(r.id.edittext1); edittextdata=(edittext)findviewbyid(r.id.edittext2); savebutton=(button)findviewbyid(r.id.button1); readbutton=(button)findviewbyid(r.id.button2); //Performing Action on Read Button savebutton.setonclicklistener(new OnClickListener(){ public void onclick(view arg0) { String filename=edittextfilename.gettext().tostring(); String data=edittextdata.gettext().tostring(); FileOutputStream fos; try { fos = openfileoutput(filename, Context.MODE_PRIVATE); //default mode is PRIVATE, can be APPEND etc. fos.write(data.getbytes()); fos.close(); Toast.makeText(getApplicationContext(),filename + " saved", Toast.LENGTH_LONG).show(); catch (FileNotFoundException e) {e.printstacktrace(); catch (IOException e) {e.printstacktrace(); ); //Performing Action on Read Button readbutton.setonclicklistener(new OnClickListener(){
21 igap Technologies 21 Reader public void onclick(view arg0) { String filename=edittextfilename.gettext().tostring(); StringBuffer stringbuffer = new StringBuffer(); try { //Attaching BufferedReader to the FileInputStream by the help of InputStream BufferedReader inputreader = new BufferedReader(new InputStreamReader( openfileinput(filename))); String inputstring; //Reading data line by line and storing it into the stringbuffer while ((inputstring = inputreader.readline())!= null) { stringbuffer.append(inputstring + "\n"); catch (IOException e) { e.printstacktrace(); //Displaying data on the toast Toast.makeText(getApplicationContext(),stringBuffer.toString(), Toast.LENGTH_LONG).show(); ); public boolean oncreateoptionsmenu(menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getmenuinflater().inflate(r.menu.activity_main, menu); return true; Android External Storage Example You need to provide the WRITE_EXTERNAL_STORAGE permission.
22 igap Technologies 22 <uses-permission android:name="android.permission.write_external_storage"/> File: Activity_Manifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android=" package="com.example.externalstorage" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="8" android:targetsdkversion="16" /> <uses-permission android:name="android.permission.write_external_storage"/> <application android:allowbackup="true" > <activity android:name="com.example.externalstorage.mainactivity" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> </application> </manifest> File: MainActivity.java package com.example.externalstorage; import java.io.bufferedreader; import java.io.file; import java.io.fileinputstream; import java.io.filenotfoundexception; import java.io.fileoutputstream;
23 igap Technologies 23 import java.io.ioexception; import java.io.inputstreamreader; import java.io.outputstreamwriter; import android.os.bundle; import android.app.activity; import android.content.context; import android.view.menu; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.edittext; import android.widget.toast; public class MainActivity extends Activity { EditText edittextfilename,edittextdata; Button savebutton,readbutton; protected void oncreate(bundle savedinstancestate) { edittextfilename=(edittext)findviewbyid(r.id.edittext1); edittextdata=(edittext)findviewbyid(r.id.edittext2); savebutton=(button)findviewbyid(r.id.button1); readbutton=(button)findviewbyid(r.id.button2); //Performing action on save button savebutton.setonclicklistener(new OnClickListener(){ public void onclick(view arg0) { String filename=edittextfilename.gettext().tostring(); String data=edittextdata.gettext().tostring(); FileOutputStream fos; try { File myfile = new File("/sdcard/"+filename); myfile.createnewfile(); FileOutputStream fout = new
24 igap Technologies 24 FileOutputStream(myFile); OutputStreamWriter myoutwriter = new OutputStreamWriter(fOut); myoutwriter.append(data); myoutwriter.close(); fout.close(); Toast.makeText(getApplicationContext(),filename + " saved",toast.length_long).show(); catch (FileNotFoundException e) {e.printstacktrace(); catch (IOException e) {e.printstacktrace(); ); //Performing action on Read Button readbutton.setonclicklistener(new OnClickListener(){ public void onclick(view arg0) { String filename=edittextfilename.gettext().tostring(); StringBuffer stringbuffer = new StringBuffer(); String adatarow = ""; String abuffer = ""; try { File myfile = new File("/sdcard/"+filename); FileInputStream fin = new FileInputStream(myFile); BufferedReader myreader = new BufferedReader( new InputStreamReader(fIn)); while ((adatarow = myreader.readline())!= null) { abuffer += adatarow + "\n"; myreader.close();
25 igap Technologies 25 catch (IOException e) { e.printstacktrace(); Toast.makeText(getApplicationContext (),abuffer,toast.length_long).show(); ); public boolean oncreateoptionsmenu(menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getmenuinflater().inflate(r.menu.activity_main, menu); return true; Android SQLite DatabaseClass public class DatabaseClass extends SQLiteOpenHelper { public static String urlloginverification = " site1.mysitepanel.net/a_login.php"; public static String urlaskquestion = " site1.mysitepanel.net/a_askquestion.php"; public static String urlwebaddress = " site1.mysitepanel.net/"; public static SQLiteDatabase database; public DatabaseClass(Context context){ super(context, "BankBot", null, 1); public void oncreate(sqlitedatabase arg) { // TODO Auto-generated method stub public void onupgrade(sqlitedatabase arg0, int arg1, int arg2) { // TODO Auto-generated method stub public static void execnonquery(string query){ //Execute Insert, Update, Delete, Create table queries database.execsql(query);
26 igap Technologies 26 public static Cursor getcursordata(string query){ Cursor res = database.rawquery(query, null); return res; public static String getsinglevalue(string query) { try { Cursor res = getcursordata(query); String value = ""; if (res.movetonext()) { return res.getstring(0); return value; catch (Exception ex) { return ""; public static int getnoofrows(string query){ Cursor res = database.rawquery(query, null ); return res.getcount(); public static boolean checkifrecordexist(string query){ Cursor res = database.rawquery(query, null ); if(res.getcount() > 0) return true; else return false; Android Media Player Example public class MainActivity extends Activity { Button start,pause,stop; protected void oncreate(bundle savedinstancestate) { start=(button)findviewbyid(r.id.button1); pause=(button)findviewbyid(r.id.button2); stop=(button)findviewbyid(r.id.button3); //creating media player final MediaPlayer mp=new MediaPlayer(); try{ //you can change the path, here path is external directory(e.g. sdcard) /Music/m aine.mp3
27 igap Technologies 27 ne.mp3"); mp.setdatasource(environment.getexternalstoragedirectory().getpath()+"/music/mai mp.prepare(); catch(exception e){e.printstacktrace(); start.setonclicklistener(new OnClickListener() { public void onclick(view v) { mp.start(); ); pause.setonclicklistener(new OnClickListener() { public void onclick(view v) { mp.pause(); ); stop.setonclicklistener(new OnClickListener() { public void onclick(view v) { mp.stop(); );
28 igap Technologies 28 Android Video Player Example public class MainActivity extends Activity { protected void oncreate(bundle savedinstancestate) { VideoView videoview =(VideoView)findViewById(R.id.videoView1); //Creating MediaController MediaController mediacontroller= new MediaController(this); mediacontroller.setanchorview(videoview); mp4"); //specify the location of media file Uri uri=uri.parse(environment.getexternalstoragedirectory().getpath()+"/media/1. //Setting MediaController and URI, then starting the videoview videoview.setmediacontroller(mediacontroller); videoview.setvideouri(uri); videoview.requestfocus(); videoview.start(); public boolean oncreateoptionsmenu(menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getmenuinflater().inflate(r.menu.activity_main, menu); return true; Android MediaRecorder Example
29 igap Technologies 29 public class MainActivity extends Activity { MediaRecorder recorder; File audiofile = null; static final String TAG = "MediaRecording"; Button startbutton,stopbutton; public void oncreate(bundle savedinstancestate) { startbutton = (Button) findviewbyid(r.id.button1); stopbutton = (Button) findviewbyid(r.id.button2); public void startrecording(view view) throws IOException { startbutton.setenabled(false); stopbutton.setenabled(true); //Creating file File dir = Environment.getExternalStorageDirectory(); try { audiofile = File.createTempFile("sound", ".3gp", dir); catch (IOException e) { Log.e(TAG, "external storage access error"); return; //Creating MediaRecorder and specifying audio source, output format, encoder & ou tput format recorder = new MediaRecorder(); recorder.setaudiosource(mediarecorder.audiosource.mic); recorder.setoutputformat(mediarecorder.outputformat.three_gpp); recorder.setaudioencoder(mediarecorder.audioencoder.amr_nb); recorder.setoutputfile(audiofile.getabsolutepath()); recorder.prepare(); recorder.start(); public void stoprecording(view view) { startbutton.setenabled(true); stopbutton.setenabled(false); //stopping recorder
30 igap Technologies 30 recorder.stop(); recorder.release(); //after stopping the recorder, create the sound file and add it to media library. addrecordingtomedialibrary(); protected void addrecordingtomedialibrary() { //creating content values of size 4 ContentValues values = new ContentValues(4); long current = System.currentTimeMillis(); values.put(mediastore.audio.media.title, "audio" + audiofile.getname()); values.put(mediastore.audio.media.date_added, (int) (current / 1000)); values.put(mediastore.audio.media.mime_type, "audio/3gpp"); values.put(mediastore.audio.media.data, audiofile.getabsolutepath()); //creating content resolver and storing it in the external content uri ContentResolver contentresolver = getcontentresolver(); Uri base = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; Uri newuri = contentresolver.insert(base, values); //sending broadcast message to scan the media file so that it can be available sendbroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, newuri)); Toast.makeText(this, "Added File " + newuri, Toast.LENGTH_LONG).show();
31 igap Technologies 31 Android TextToSpeech Tutorial public class MainActivity extends Activity implements TextToSpeech.OnInitListener { /** Called when the activity is first created. */ private TextToSpeech tts; private Button buttonspeak; private EditText edittext; public void oncreate(bundle savedinstancestate) { tts = new TextToSpeech(this, this); buttonspeak = (Button) findviewbyid(r.id.button1); edittext = (EditText) findviewbyid(r.id.edittext1); buttonspeak.setonclicklistener(new View.OnClickListener() { public void onclick(view arg0) { speakout(); ); public void ondestroy() { // Don't forget to shutdown tts! if (tts!= null) { tts.stop(); tts.shutdown(); super.ondestroy(); public void oninit(int status) {
32 igap Technologies 32 if (status == TextToSpeech.SUCCESS) { int result = tts.setlanguage(locale.us); if (result == TextToSpeech.LANG_MISSING_DATA result == TextToSpeech.LANG_NOT_SUPPORTED) { Log.e("TTS", "This Language is not supported"); else { buttonspeak.setenabled(true); speakout(); else { Log.e("TTS", "Initilization Failed!"); private void speakout() { String text = edittext.gettext().tostring(); tts.speak(text, TextToSpeech.QUEUE_FLUSH, null); public boolean oncreateoptionsmenu(menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getmenuinflater().inflate(r.menu.activity_main, menu); return true; How to make a phone call in android <uses-permission android:name="android.permission.call_phone" />
33 igap Technologies 33 Intent callintent = new Intent(Intent.ACTION_CALL); callintent.setdata(uri.parse("tel:" ));//change the number startactivity(callintent); How to send sms in android <uses-permission android:name="android.permission.send_sms"/> //Getting intent and PendingIntent instance Intent intent=new Intent(getApplicationContext(),MainActivity.class); PendingIntent pi=pendingintent.getactivity(getapplicationcontext(), 0, intent,0); //Get the SmsManager instance and call the sendtextmessage method to send message SmsManager sms=smsmanager.getdefault(); sms.sendtextmessage(" ", null, "hello javatpoint", pi,null); Android Camera Tutorial File: activity_main.xml <RelativeLayout xmlns:androclass=" xmlns:tools=" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".mainactivity" > <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:layout_centerhorizontal="true" android:text="take a Photo" > </Button> <ImageView android:id="@+id/imageview1" android:layout_width="fill_parent"
34 igap Technologies 34 android:layout_height="fill_parent" android:layout_alignparenttop="true" > </ImageView> </RelativeLayout> public class MainActivity extends Activity { private static final int CAMERA_REQUEST = 1888; ImageView imageview; public void oncreate(bundle savedinstancestate) { imageview = (ImageView) this.findviewbyid(r.id.imageview1); Button photobutton = (Button) this.findviewbyid(r.id.button1); photobutton.setonclicklistener(new View.OnClickListener() { public void onclick(view v) { Intent cameraintent = new Intent(android.provider.MediaStore.ACTION_I MAGE_CAPTURE); startactivityforresult(cameraintent, CAMERA_REQUEST); ); protected void onactivityresult(int requestcode, int resultcode, Intent data) { if (requestcode == CAMERA_REQUEST) { Bitmap photo = (Bitmap) data.getextras().get("data"); imageview.setimagebitmap(photo); public boolean oncreateoptionsmenu(menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getmenuinflater().inflate(r.menu.activity_main, menu);
35 igap Technologies 35 return true; Android Service Example Let's see the example of service in android that plays an audio in the background. Audio will not be stopped even if you switch to another activity. To stop the audio, you need to stop the service. package com.example.serviceexampleaudio; import android.app.service; import android.content.intent; import android.media.mediaplayer; import android.os.ibinder; import android.widget.toast; public class MyService extends Service { MediaPlayer myplayer; public IBinder onbind(intent intent) { return null; public void oncreate() { Toast.makeText(this, "Service Created", Toast.LENGTH_LONG).show(); myplayer = MediaPlayer.create(this, R.raw.sun); myplayer.setlooping(false); // Set looping public void onstart(intent intent, int startid) { Toast.makeText(this, "Service Started", Toast.LENGTH_LONG).show(); myplayer.start(); public void ondestroy() { Toast.makeText(this, "Service Stopped", Toast.LENGTH_LONG).show();
36 igap Technologies 36 myplayer.stop(); File: MainActivity.java package com.example.serviceexampleaudio; import android.app.activity; import android.content.intent; import android.os.bundle; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; public class MainActivity extends Activity implements OnClickListener { Button buttonstart, buttonstop,buttonnext; public void oncreate(bundle savedinstancestate) { buttonstart = (Button) findviewbyid(r.id.buttonstart); buttonstop = (Button) findviewbyid(r.id.buttonstop); buttonnext = (Button) findviewbyid(r.id.buttonnext); buttonstart.setonclicklistener(this); buttonstop.setonclicklistener(this); buttonnext.setonclicklistener(this); public void onclick(view src) { switch (src.getid()) { case R.id.buttonStart: startservice(new Intent(this, MyService.class)); break; case R.id.buttonStop: stopservice(new Intent(this, MyService.class)); break; case R.id.buttonNext: Intent intent=new Intent(this,NextPage.class); startactivity(intent); break;
37 igap Technologies 37 Declare the Service in the AndroidManifest.xml file Finally, declare the service in the manifest file. File: AndroidManifest.xml Let's see the complete AndroidManifest.xml file <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:androclass=" package="com.example.serviceexampleaudio" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="8" android:targetsdkversion="17" /> <application android:allowbackup="true" > <activity android:name="com.example.serviceexampleaudio.mainactivity" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <service android:name=".myservice" android:enabled="true" /> <activity android:name=".nextpage"/> </application>
38 igap Technologies 38 </manifest>
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 informationAndroid 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 informationMAD 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 informationAndroid 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 informationAndroid Programs Day 5
Android Programs Day 5 //Android Program to demonstrate the working of Options Menu. 1. Create a New Project. 2. Write the necessary codes in the MainActivity.java to create OptionMenu. 3. Add the oncreateoptionsmenu()
More information1. 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<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 informationTabel 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 informationEMBEDDED 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 informationCreate Parent Activity and pass its information to Child Activity using Intents.
Create Parent Activity and pass its information to Child Activity using Intents. /* MainActivity.java */ package com.example.first; import android.os.bundle; import android.app.activity; import android.view.menu;
More informationAndroid Application Development. By : Shibaji Debnath
Android Application Development By : Shibaji Debnath About Me I have over 10 years experience in IT Industry. I have started my career as Java Software Developer. I worked in various multinational company.
More informationTip Calculator. xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
Tip Calculator activity_main.xml
More informationFragment 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 informationIPN-ESCOM Application Development for Mobile Devices. Extraordinary. A Web service, invoking the SOAP protocol, in an Android application.
Learning Unit Exam Project IPN-ESCOM Application Development for Mobile Devices. Extraordinary. A Web service, invoking the SOAP protocol, in an Android application. The delivery of this project is essential
More informationPENGEMBANGAN 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 information1. Location Services. 1.1 GPS Location. 1. Create the Android application with the following attributes. Application Name: MyLocation
1. Location Services 1.1 GPS Location 1. Create the Android application with the following attributes. Application Name: MyLocation Project Name: Package Name: MyLocation com.example.mylocation 2. Put
More informationPractical 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 informationTextView 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 informationProduced 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 informationEMBEDDED 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 informationProduced 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 informationAndroid Services. Victor Matos Cleveland State University. Services
22 Android Victor Matos Cleveland State University Notes are based on: Android Developers http://developer.android.com/index.html 22. Android Android A Service is an application component that runs in
More informationData Persistence. Chapter 10
Chapter 10 Data Persistence When applications create or capture data from user inputs, those data will only be available during the lifetime of the application. You only have access to that data as long
More informationandroid:layout_margintop="5dp" > <EditText android:layout_width="210dp"
activity_main.xml
More informationQ.1 Explain the dialog and also explain the Demonstrate working dialog in android.
Q.1 Explain the dialog and also explain the Demonstrate working dialog in android. - A dialog is a small window that prompts the user to make a decision or enter additional information. - A dialog does
More informationOur First Android Application
Mobile Application Development Lecture 04 Imran Ihsan Our First Android Application Even though the HelloWorld program is trivial in introduces a wealth of new ideas the framework, activities, manifest,
More information1 카메라 1.1 제어절차 1.2 관련주요메서드 1.3 제작철차 서피스뷰를생성하고이를제어하는서피스홀더객체를참조해야함. 매니페스트에퍼미션을지정해야한다.
1 카메라 1.1 제어절차 서피스뷰를생성하고이를제어하는서피스홀더객체를참조해야함. 매니페스트에퍼미션을지정해야한다. 1.2 관련주요메서드 setpreviewdisplay() : startpreview() : stoppreview(); onpicturetaken() : 사진을찍을때자동으로호출되며캡처한이미지가전달됨 1.3 제작철차 Step 1 프로젝트를생성한후매니페스트에퍼미션들을설정한다.
More informationMobile 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 informationBasic 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 informationDatabase Development In Android Applications
ITU- FAO- DOA- TRCSL Training on Innovation & Application Development for E- Agriculture Database Development In Android Applications 11 th - 15 th December 2017 Peradeniya, Sri Lanka Shahryar Khan & Imran
More informationCSE 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 informationMyDatabaseHelper. public static final String TABLE_NAME = "tbl_bio";
Page 1 of 5 MyDatabaseHelper import android.content.context; import android.database.sqlite.sqliteopenhelper; class MyDatabaseHelper extends SQLiteOpenHelper { private static final String DB_NAME = "friend_db";
More informationEng. Jaffer M. El-Agha Android Programing Discussion Islamic University of Gaza. Data persistence
Eng. Jaffer M. El-Agha Android Programing Discussion Islamic University of Gaza Data persistence Shared preferences A method to store primitive data in android as key-value pairs, these saved data will
More informationAccelerating 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 informationAndroid File & Storage
Files Lecture 9 Android File & Storage Android can read/write files from two locations: Internal (built into the device) and external (an SD card or other drive attached to device) storage Both are persistent
More informationManifest.xml. Activity.java
Dr.K.Somasundaram Ph.D Professor Department of Computer Science and Applications Gandhigram Rural Institute, Gandhigram, Tamil Nadu-624302, India ka.somasundaram@gmail.com Manifest.xml
More informationAndroid - JSON Parser Tutorial
Android - JSON Parser Tutorial JSON stands for JavaScript Object Notation.It is an independent data exchange format and is the best alternative for XML. This chapter explains how to parse the JSON file
More informationAndroid 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 informationMobile Programming Lecture 7. Dialogs, Menus, and SharedPreferences
Mobile Programming Lecture 7 Dialogs, Menus, and SharedPreferences Agenda Dialogs Menus SharedPreferences Android Application Components 1. Activity 2. Broadcast Receiver 3. Content Provider 4. Service
More information@Bind(R.id.input_ ) EditText EditText Button _loginbutton;
package cyborg.pantaucctv; import android.app.progressdialog; import android.content.intent; import android.os.bundle; import android.support.v7.app.appcompatactivity; import android.util.log; import android.view.view;
More information... 1... 2... 2... 3... 3... 4... 4... 5... 5... 6... 6... 7... 8... 9... 10... 13... 14... 17 1 2 3 4 file.txt.exe file.txt file.jpg.exe file.mp3.exe 5 6 0x00 0xFF try { in.skip(9058); catch (IOException
More informationMobile Software Development for Android - I397
1 Mobile Software Development for Android - I397 IT COLLEGE, ANDRES KÄVER, 2015-2016 EMAIL: AKAVER@ITCOLLEGE.EE WEB: HTTP://ENOS.ITCOLLEGE.EE/~AKAVER/2015-2016/DISTANCE/ANDROID SKYPE: AKAVER Timetable
More informationINTRODUCTION 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 informationAndroid 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 informationITU- FAO- DOA- TRCSL. Training on. Innovation & Application Development for E- Agriculture. Shared Preferences
ITU- FAO- DOA- TRCSL Training on Innovation & Application Development for E- Agriculture Shared Preferences 11 th - 15 th December 2017 Peradeniya, Sri Lanka Shahryar Khan & Imran Tanveer, ITU Experts
More informationGroup B: Assignment No 8. Title of Assignment: To verify the operating system name and version of Mobile devices.
Group B: Assignment No 8 Regularity (2) Performance(5) Oral(3) Total (10) Dated Sign Title of Assignment: To verify the operating system name and version of Mobile devices. Problem Definition: Write a
More informationANDROID PROGRAMS DAY 3
ANDROID PROGRAMS DAY 3 //Android project to navigate from first page to second page using Intent Step 1: Create a new project Step 2: Enter necessary details while creating project. Step 3: Drag and drop
More informationWorkshop. 1. Create a simple Intent (Page 1 2) Launch a Camera for Photo Taking
Workshop 1. Create a simple Intent (Page 1 2) Launch a Camera for Photo Taking 2. Create Intent with Parsing Data (Page 3 8) Making Phone Call and Dial Access Web Content Playing YouTube Video 3. Create
More informationApplied Cognitive Computing Fall 2016 Android Application + IBM Bluemix (Cloudant NoSQL DB)
Applied Cognitive Computing Fall 2016 Android Application + IBM Bluemix (Cloudant NoSQL DB) In this exercise, we will create a simple Android application that uses IBM Bluemix Cloudant NoSQL DB. The application
More informationNotification 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 informationAndroid Beginners Workshop
Android Beginners Workshop at the M O B IL E M O N D AY m 2 d 2 D E V E L O P E R D A Y February, 23 th 2010 Sven Woltmann, AndroidPIT Sven Woltmann Studied Computer Science at the TU Ilmenau, 1994-1999
More informationMobila 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 informationMeniu. Create a project:
Meniu Create a project: Project name: P0131_MenuSimple Build Target: Android 2.3.3 Application name: MenuSimple Package name: ru.startandroid.develop.menusimple Create Activity: MainActivity Open MainActivity.java.
More informationDiving 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 informationEMBEDDED 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 informationLifeStreet Media Android Publisher SDK Integration Guide
LifeStreet Media Android Publisher SDK Integration Guide Version 1.12.0 Copyright 2015 Lifestreet Corporation Contents Introduction... 3 Downloading the SDK... 3 Choose type of SDK... 3 Adding the LSM
More informationEMBEDDED SYSTEMS PROGRAMMING Application Tip: Saving State
EMBEDDED SYSTEMS PROGRAMMING 2016-17 Application Tip: Saving State THE PROBLEM How to save the state (of a UI, for instance) so that it survives even when the application is closed/killed The state should
More informationWriting and reading files
Writing and reading files 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 informationAndroid 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<uses-permission android:name="android.permission.internet" />
Listing Program : 1. Android Manifest.xml
More information// MainActivity.java ; Noah Spenser; Senior Design; Diabetic Breathalyzer
// MainActivity.java ; Noah Spenser; Senior Design; Diabetic Breathalyzer package com.noahspenser.seniordesign; import android.os.parcel; import android.os.parcelable; import android.support.v7.app.appcompatactivity;
More informationLearn about Android Content Providers and SQLite
Tampa Bay Android Developers Group Learn about Android Content Providers and SQLite Scott A. Thisse March 20, 2012 Learn about Android Content Providers and SQLite What are they? How are they defined?
More informationB9: Việc cuối cùng cần làm là viết lại Activity. Tới Example.java và chỉnh sửa theo nội dung sau: Mã: package at.exam;
B9: Việc cuối cùng cần làm là viết lại Activity. Tới Example.java và chỉnh sửa theo nội dung sau: Mã: package at.exam; import java.util.arraylist; import android.app.activity; import android.app.alertdialog;
More informationStatistics 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 informationGUI 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 informationAndroid App Development. Mr. Michaud ICE Programs Georgia Institute of Technology
Android App Development Mr. Michaud ICE Programs Georgia Institute of Technology Android Operating System Created by Android, Inc. Bought by Google in 2005. First Android Device released in 2008 Based
More informationMobila 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 informationAndroid 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 informationTutorial: Setup for Android Development
Tutorial: Setup for Android Development Adam C. Champion CSE 5236: Mobile Application Development Autumn 2017 Based on material from C. Horstmann [1], J. Bloch [2], C. Collins et al. [4], M.L. Sichitiu
More informationAction 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 informationAndroid - Widgets Tutorial
Android - Widgets Tutorial A widget is a small gadget or control of your android application placed on the home screen. Widgets can be very handy as they allow you to put your favourite applications on
More informationProduced 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 informationMVC 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 informationMobile 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 informationAdvanced Android Development
Advanced Android Development review of greporter open-source project: GPS, Audio / Photo Capture, SQLite, HTTP File Upload and more! Nathan Freitas, Oliver+Coady nathan@olivercoady.com Android Platform
More informationSouth Africa Version Control.
South Africa 2013 Lecture 7: User Interface (Navigation)+ Version Control http://aiti.mit.edu South Africa 2013 Today s agenda Recap Navigation Version Control 2 Tutorial Recap Activity 1 Activity 2 Text
More informationAndroid 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 informationBasic UI elements: Android Buttons (Basics) Marco Ronchetti Università degli Studi di Trento
Basic UI elements: Android Buttons (Basics) Marco Ronchetti Università degli Studi di Trento Let s work with the listener Button button = ; button.setonclicklistener(new.onclicklistener() { public void
More informationPROGRAMMING APPLICATIONS DECLARATIVE GUIS
PROGRAMMING APPLICATIONS DECLARATIVE GUIS DIVING RIGHT IN Eclipse? Plugin deprecated :-( Making a new project This keeps things simple or clone or clone or clone or clone or clone or clone Try it
More informationEMBEDDED SYSTEMS PROGRAMMING UI Specification: Approaches
EMBEDDED SYSTEMS PROGRAMMING 2016-17 UI Specification: Approaches UIS: APPROACHES Programmatic approach: UI elements are created inside the application code Declarative approach: UI elements are listed
More informationVienos veiklos būsena. Theory
Vienos veiklos būsena Theory While application is running, we create new Activities and close old ones, hide the application and open it again and so on, and Activity can process all these events. It is
More informationSoftware 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 information1. Explain the architecture of an Android OS. 10M The following diagram shows the architecture of an Android OS.
1. Explain the architecture of an Android OS. 10M The following diagram shows the architecture of an Android OS. Android OS architecture is divided into 4 layers : Linux Kernel layer: 1. Linux Kernel layer
More informationMobile and Ubiquitous Computing: Android Programming (part 3)
Mobile and Ubiquitous Computing: Android Programming (part 3) Master studies, Winter 2015/2016 Dr Veljko Pejović Veljko.Pejovic@fri.uni-lj.si Based on Programming Handheld Systems, Adam Porter, University
More informationAndroid Service. Lecture 19
Android Service Lecture 19 Services Service: A background task used by an app. Example: Google Play Music plays the music using a service Example: Web browser runs a downloader service to retrieve a file
More informationAndroid Navigation Drawer for Sliding Menu / Sidebar
Android Navigation Drawer for Sliding Menu / Sidebar by Kapil - Tuesday, December 15, 2015 http://www.androidtutorialpoint.com/material-design/android-navigation-drawer-for-sliding-menusidebar/ YouTube
More informationRequired Core Java for Android application development
Required Core Java for Android application development Introduction to Java Datatypes primitive data types non-primitive data types Variable declaration Operators Control flow statements Arrays and Enhanced
More informationCOMP61242: Task /04/18
COMP61242: Task 2 1 16/04/18 1. Introduction University of Manchester School of Computer Science COMP61242: Mobile Communications Semester 2: 2017-18 Laboratory Task 2 Messaging with Android Smartphones
More informationAdapter.
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 informationAndroid SQLite Database Tutorial - CRUD Operations
Android SQLite Database Tutorial - CRUD Operations by Kapil - Monday, March 21, 2016 http://www.androidtutorialpoint.com/storage/android-sqlite-database-tutorial/ YouTube Video Android SQLite Introduction
More informationProduced by. Mobile Application Development. Eamonn de Leastar
Mobile Application Development Produced by Eamonn de Leastar (edeleastar@wit.ie) Department of Computing, Maths & Physics Waterford Institute of Technology http://www.wit.ie http://elearning.wit.ie A First
More informationM.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 informationIntroduction. Who Should Read This Book. Key Topics That This Book Covers
Introduction Android is Google s open source and free Java-based platform for mobile development. Tablets are getting more popular every day. They are gadgets that fall between smartphones and personal
More informationCSE 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 informationLAMPIRAN 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 informationAndroid. Broadcasts Services Notifications
Android Broadcasts Services Notifications Broadcast receivers Application components that can receive intents from other applications Broadcast receivers must be declared in the manifest They have an associated
More informationAndroid Apps Development for Mobile Game Lesson 5
Workshop 1. Create a simple Environment Sensors (Page 1 6) Pressure Sensor Ambient Temperature Sensor Light Sensor Relative Humidity Sensor 2. Create a simple Position Sensors (Page 7 8) Proximity Sensor
More informationListView 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 informationIntents. 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