Call android to pop out an list for user to pick up a system contact data.
startActivityForResult(new Intent(Intent.ACTION_PICK,
android.provider.ContactsContract.Contacts.CONTENT_URI),user-defined);
System may do the following process.
Button pickButton=(Button)findViewById(R.id.pick_button);
pickButton.setOnclickListener(new View.OnClickListener(){
public void onClick(View view){
//Store the URI of the selected item
Uri data=Uri.parse(“content://horses/”+ selected_id);
Intent result=new Intent(null,data);
result.putExtra(IS_INPUT_CORRECT,inputCorrect);
result.putExtra(SELECTED_PISTOL,selectedPistol);
setResult(RESULT_OK,result);
finish();
}
});
Return the result to activity
protected void onActivityResult (int requestCode, int resultCode, Intent data)
{
//Abstract data from intent
Uri uriRet = data.getData()
boolean inputCorrect=data.getBooleanExtra( IS_INPUT_CORRECT,false);
String selectedPistol=data.getStringExtra( SELECTED_PISTOL);
}
沒有留言:
張貼留言