1.ActionBar
Basic use
New activity to inherit from Actionbaractivity, get a Actionbar instance when you want to import V7 under the package Getsupportactionbar ();
Search and share the action Bar
(Note: Due to eclipse, various errors were encountered while importing the V7 package, Actionbar part is temporarily skipped)
Navigation bar
2. Telephone Service
Telephonymanager
Monitor phone status Codes
Mainactivity
Package Com.example.telephonytest;import Android.app.activity;import Android.content.context;import Android.os.bundle;import Android.telephony.phonestatelistener;import Android.telephony.telephonymanager;public Class Mainactivity extends Activity {@Override protected void onCreate (Bundle savedinstancestate) {Super.on Create (savedinstancestate); Setcontentview (R.layout.activity_main); Telephonemanager (); } public void Telephonemanager () {Telephonymanager TM = (Telephonymanager) getsystemservice (Context.telephony_servic E); Tm.listen (New Myphonelistener (), phonestatelistener.listen_call_state); }//The Myphonelistener here is a class instead of an interface private static class Myphonelistener extends phonestatelistener{//rewrite Oncallstatechanged method @Override public void oncallstatechanged (int state, String incomingnumber) {//TODO Auto-ge nerated method Stub super.oncallstatechanged (state, Incomingnumber); Switch (state) {case Telephonymanager. CALL_STATE_IDLE:System.out.println ("Hanging machine status ..."); Break Case TelephonyManager.CALL_STATE_OFFHOOK:System.out.println ("Catch status ..."); Break Case TelephonyManager.CALL_STATE_RINGING:System.out.println ("ringing status ..."); Break } } }}
Manifest file
<uses-permission android:name= "Android.permission.READ_PHONE_STATE"/>
Caller ID Display Case
3.APP content Sharing
Share text and picture content
Share Simple text content code
Mainactivity
Package Com.example.appsharetest;import Android.app.activity;import Android.content.intent;import Android.os.bundle;import Android.view.view;public class Mainactivity extends Activity {@Overrideprotected void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate); Setcontentview (R.layout.activity_main);} public void Sharetextclick (view view) {Intent Intent = new Intent (); intent.setaction (intent.action_send); Intent.settype ("Text/plain"); Intent.putextra (Intent.extra_text, "Share simple text content"); StartActivity (intent);// StartActivity (Intent.createchooser (Intent, "specify selector"));}}
Share the image content code
Mainactivity
public void Shareimageclick (view view) {URI uri = uri.parse ("/sdcard/1.jpg"); Intent Intent = new Intent (); Intent.setaction (Intent.action_send); Intent.settype ("image/jpg"); Intent.putextra (Intent.extra_stream,uri); StartActivity (Intent.createchooser (Intent, "share picture to"));}
Share multiple pieces of content and receive
Receive simple data from other applications
Using Shareactionprovider
The 13th day of Actionbar School notes, telephone service and content sharing