views:

47

answers:

2

dear friends,

i am using following code to open Android Contacts

  @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        btnContacts = (Button) findViewById(R.id.btn_contacts);   
        txtContacts = (TextView) findViewById(R.id.txt_contacts);   

        btnContacts.setOnClickListener(new OnClickListener() {   
            public void onClick(View arg0) {   
                txtContacts.setText("");
                Intent intent = new Intent(Intent.ACTION_PICK, People.CONTENT_URI);   
                startActivityForResult(intent, PICK_CONTACT);   
            }   
        });   
}



 @Override  
    public void onActivityResult(int reqCode, int resultCode, Intent data) {   
        super.onActivityResult(reqCode, resultCode, data);   

        switch (reqCode) {   
            case (PICK_CONTACT):   
                if (resultCode == Activity.RESULT_OK) {   

//display picked contact data.
}

}

}

now i want to put Button at the top of this Contact activity when opened or add my own Menu in this Activity

can any one guide me is this possible or not if yes then please tell how to achieve this?

any help would be appriciated.

A: 

I don't believe that is possible as each Activity in Android is working on its own and by starting the Intent, you are basically giving the new Activity the focus (and control).

One way to do something like this would be to build a custom contact list activity that uses the public data providers to access the contacts and simply lists them then. Then you could add as many custom functions as you like or even add Intents for original actions (like viewing a contact's details).

poke
A: 

I too am looking for this.

I looked at the source code and didn't find any "hook" or "backdoor" to allow this. This is retarded. I've programmed for the BlackBerry and you can do this easily. Why not the same on Android??

I need the same thing for inside the phone app. If anybody has an idea please let us know.

Emmanuel

Emmanuel