Perform some action with custom field of Contact

后端 未结 1 533
说谎
说谎 2020-12-30 11:12

I have added custom field for my Contacts. It consists of:


 

        
1条回答
  •  旧巷少年郎
    2020-12-30 11:57

    I found the answer. We can implement such functionality by: 1) creating new type of Contacts field (see link at the end of answer);

    2) creating an Activity, which will perform this action:

    if (getIntent().getData() != null) {
            Cursor cursor = managedQuery(getIntent().getData(), null, null, null, null);
            if (cursor.moveToNext()) {
                String username = cursor.getString(cursor.getColumnIndex("DATA1"));
                TextView tv = (TextView) findViewById(R.id.profiletext);
                tv.setText("This is the profile for " + username);
            }
        } else {
            // How did we get here without data?
            finish();
        }
    

    3) adding special intent to Activity in our Manifest.xml:

    
            
                
                
                
            
        
    

    The answer (and full tutorial) was found here.

    0 讨论(0)
提交回复
热议问题