Android Programming The Big Nerd Ranch Guide, 3rd Edition

(Brent) #1
Checking for responding activities

303

Listing 15.15  Adding dummy code to verify filter (CrimeFragment.java)


public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
...
final Intent pickContact = new Intent(Intent.ACTION_PICK,
ContactsContract.Contacts.CONTENT_URI);
pickContact.addCategory(Intent.CATEGORY_HOME);
mSuspectButton = (Button) v.findViewById(R.id.crime_suspect);
mSuspectButton.setOnClickListener(new View.OnClickListener() {
...
});


Run CriminalIntent again, and you should see the suspect button disabled (Figure 15.6).


Figure 15.6  Disabled suspect button


Delete the dummy code once you are done verifying this behavior.


Listing 15.16  Deleting dummy code (CrimeFragment.java)


public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
...
final Intent pickContact = new Intent(Intent.ACTION_PICK,
ContactsContract.Contacts.CONTENT_URI);
pickContact.addCategory(Intent.CATEGORY_HOME);
mSuspectButton = (Button) v.findViewById(R.id.crime_suspect);
mSuspectButton.setOnClickListener(new View.OnClickListener() {
...
});


http://www.ebook3000.com

Free download pdf