TQC-301 查詢通訊錄
這是TQC的301題,
程式碼為自行撰寫,
僅供參考。
主要練習查詢通訊錄,
照舊權限還是要設定。
package COM.TQC.GDD03;
import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.provider.Contacts.People;
import android.widget.TextView;
public class GDD03 extends Activity
{
private String queryAction;
private TextView mTextView01;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
findview();
setlistener();
}
public void findview()
{
mTextView01 = (TextView)this.findViewById(R.id.myTextView1);
}
public void setlistener()
{
if (Intent.ACTION_SEARCH.equals(queryAction))
{
//Intent i = new Intent(Intent.ACTION_VIEW, People.CONTENT_URI);
//startActivity(i);
Intent i=new Intent(Intent.ACTION_VIEW,People.CONTENT_URI);
startActivity(i);
}
setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);
onSearchRequested();
}
}
自我LV~