- 博客(19)
- 资源 (2)
- 收藏
- 关注
原创 Working in the Background
Creating a Serviceimport android.app.Service;import android.content.Intent;import android.os.IBinder;public class MyService extends Service {@Overridepublic void onCreate() {// TODO: Actions to perform when service is created.}@Overridepublic IBinder onBin
2010-06-07 13:24:00
1027
1
原创 Maps,Geocoding,and Location-Based Services
SELECTING A LOCATION PROVIDERTo get an instance of a specific provider, call getProvider, passing in the name:String providerName = LocationManager.GPS_PROVIDER;LocationProvider gpsProvider;gpsProvider = locationManager.getProvider(providerName);Finding the
2010-06-04 17:03:00
877
原创 CREATING A NEW CONTENT PROVIDER
Creating a new Content Providerimport android.content.*;import android.database.Cursor;import android.net.Uri;import android.database.SQLException;public class MyProvider extends ContentProvider {@Overridepublic boolean onCreate() {// TODO Construct the un
2010-06-03 17:50:00
892
1
原创 WORKING WITH SQLite DATABASES
Skeleton code for a standard database adapter implementationimport android.content.Context;import android.database.*;import android.database.sqlite.*;import android.database.sqlite.SQLiteDatabase.CursorFactory;import android.util.Log;public class MyDBAdapt
2010-06-03 17:17:00
504
1
原创 Files and prefernces
<br />Using the SharedPreferences class you can create named maps of key/value pairs within your<br />application that can be shared among application components running in the same application<br />context.<br /> <br /> call getSharedPreferences on the ap
2010-06-02 15:07:00
701
原创 INTRODUCING DIALOGS
<br />There are three ways to implement a dialog in Android: .<br /> <br />1. Using the Dialog class (or its extensions) As well<br />as the general-purpose AlertDialog class, Android<br />includes a number of specialist classes that extend<br />Dialog.<br
2010-06-02 11:32:00
451
原创 USING INTERNET RESOURCES
<br />There are a number of benefits to creating thick- and thin-client native applications rather than relying<br />on entirely web-based solutions:<br />Bandwidth Caching Native features<br /> <br />Mobile Internet GPRS, EDGE, and 3G Internet access is
2010-06-02 11:19:00
452
原创 INTRODUCING ADAPTERS
<br /> <br />Adapters are bridging classes that bind data to Views (such as List Views) used in the user interface.<br /> <br />Some Native Adapters<br /><br />ArrayAdapter The Array Adapter uses generics to bind an Adapter View to an array of<br />objects
2010-06-02 11:08:00
430
原创 INTRODUCING PENDING INTENTS
<br />// Start an Activity<br />Intent startActivityIntent = new Intent(this, MyOtherActivity.class);<br />PendingIntent.getActivity(this, 0, startActivityIntent, 0);<br />// Broadcast an Intent<br />Intent broadcastIntent = new Intent(NEW_LIFEFORM_DETECTE
2010-06-02 10:57:00
317
原创 Using Intents to Broadcast Events
<br />public static final String NEW_LIFEFORM_DETECTED ="com.paad.action.NEW_LIFEFORM";<br /> <br />Broadcasting an Intent<br /> <br />Intent intent = new Intent(NEW_LIFEFORM_DETECTED);<br />intent.putExtra("lifeformName", lifeformType);<br />intent.putExt
2010-06-02 10:34:00
412
原创 Text link
<br />Linkify<br />TextView textView = (TextView)findViewById(R.id.myTextView);<br />Linkify.addLinks(textView, Linkify.WEB_URLS|Linkify.EMAIL_ADDRESSES);<br /> <br />Use linkify in xml<br /> <br /><TextView<br />android:layout_width="fill_parent"<br />and
2010-06-02 10:17:00
559
原创 使用Intent filter 匹配相应的Activity or services
<br />1. action 用action来匹配<br />2. action 相同时用category filter<br />3. 前两者都相同时用 data来filter <br /> <br />例如:<br /><activity android:name=".abc" android:label="@string/app_name"><br /><intent-filter><br /><action android:name="android.intent.action.PICK"></
2010-06-02 10:02:00
442
原创 Intent info
<br />Description<br /> <br /> 1 明确指定start an activity or service<br /> 2 broadcast that an event (or action) has occurred<br /> 3 Declare your intention that an Activity or Service be started to perform an action, usually<br />with (or on) a particular
2010-06-01 17:53:00
352
原创 Android menu system
1.Icon menu icon&short text2.Expaned menu3.Submenuscreate icon menupublic boolean onCreateOptionsMenu(Menu menu){}// Create a new check box item.menu.add(0, CHECKBOX_ITEM, Menu.NONE, "CheckBox").setCheckable(true);// Create a radio button group.menu.add(RB
2010-06-01 16:52:00
800
原创 Activity 生命周期
Activty lifetimes like thisonCreate--->onRestart----->onStart---->onResume---->onRestoreInstanceState---->onSaveInstanceState---->onPause----->onStop---->onDestory其中onResume到onPause为active周期onStart到onStop 为invisible onCreate 整个生命周的第一个环节,用来初始化Activity 和 inc
2010-06-01 10:59:00
383
原创 get resource from xml
<br />Resources myResources = getResources();<br />CharSequence styledText = myResources.getText(R.string.stop_message);<br />Drawable icon = myResources.getDrawable(R.drawable.app_icon);<br />int opaqueBlue = myResources.getColor(R.color.opaque_blue);<br
2010-05-31 17:41:00
460
原创 styles and theme
<br /><?xml version="1.0" encoding="utf-8"?><br /><resources><br /><style name="BaseText"><br /><item name="android:textSize">14sp</item><br /><item name="android:textColor">#111</item><br /></style><br /><style name="SmallText" parent="BaseText"><br /><it
2010-05-31 17:00:00
321
原创 Android string format with html
<br /><string name="stop_message"><b>Stop</b>. %1$s</string><br /> <br /> <br />like this<br /> <br />String rString = getString(R.string.stop_message);<br />String fString = String.format(rString, "Collaborate and listen.");<br />CharSequence styled
2010-05-31 16:55:00
953
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人