android Programming Glossary: getactivity
AlphabetIndexer with Custom Adapter managed by LoaderManager http://stackoverflow.com/questions/10224233/alphabetindexer-with-custom-adapter-managed-by-loadermanager COLLATE LOCALIZED ASC return new CursorLoader getActivity baseUri CONTACTS_SUMMARY_PROJECTION selection null sortOrder.. the loaded data. mAdapter new ContactsCursorAdapter getActivity .getApplicationContext R.layout.contact_manager null from to..
SimpleCursorTreeAdapter and CursorLoader for ExpandableListView http://stackoverflow.com/questions/10611927/simplecursortreeadapter-and-cursorloader-for-expandablelistview new String String.valueOf id cl new CursorLoader getActivity contactsUri CONTACTS_PROJECTION selection selectionArgs sortOrder.. COLLATE LOCALIZED ASC cl new CursorLoader getActivity groupsUri GROUPS_SUMMARY_PROJECTION selection null sortOrder.. Set up our adapter mAdapter new GroupsAdapter getActivity this android.R.layout.simple_expandable_list_item_1 android.R.layout.simple_expandable_list_item_1..
Jelly Bean DatePickerDialog — is there a way to cancel? http://stackoverflow.com/questions/11444238/jelly-bean-datepickerdialog-is-there-a-way-to-cancel DatePickerDialogFragment picker.setArguments b picker.show getActivity .getSupportFragmentManager frag_date_picker And that's all it.. DatePickerDialogFragment picker.setArguments b picker.show getActivity .getSupportFragmentManager fragment_date_picker share improve..
How to transfer the formatted date string from my DatePickerFragment? http://stackoverflow.com/questions/18211684/how-to-transfer-the-formatted-date-string-from-my-datepickerfragment DatePickerDialog and return it return new DatePickerDialog getActivity this year month day @Override public void onDateSet DatePicker.. int day c.get Calendar.DAY_OF_MONTH listener TheListener getActivity Create a new instance of DatePickerDialog and return it return.. DatePickerDialog and return it return new DatePickerDialog getActivity this year month day @Override public void onDateSet DatePicker..
How do I load a contact Photo? http://stackoverflow.com/questions/2383580/how-do-i-load-a-contact-photo view.findViewById R.id.friend new QuickContactHelper getActivity badge phoneNumber .addThumbnail Now there are ways to be more..
Android keeps caching my intents Extras, how to declare a pending intent that keeps fresh extras? http://stackoverflow.com/questions/3140072/android-keeps-caching-my-intents-extras-how-to-declare-a-pending-intent-that-ke result.toArray PendingIntent contentIntent PendingIntent.getActivity context 0 intent 0 then this is used by a notification manager.. UPDATE Also the lightly documented second parameter to getActivity and kin on PendingIntent apparently can be used to create distinct..
MapView in a Fragment (Honeycomb) http://stackoverflow.com/questions/5109336/mapview-in-a-fragment-honeycomb programmatically and pass the associated activity via getActivity as Context to the MapView constructor. Does not work E AndroidRuntime..
ViewPager and fragments ??what's the right way to store fragment's state? http://stackoverflow.com/questions/7951730/viewpager-and-fragments-whats-the-right-way-to-store-fragments-state new ArrayList Message mAdapter new MessageArrayAdapter getActivity mMessagesList setListAdapter mAdapter @Override public void..
Starting Activity from Fragment causes NullPointerException http://stackoverflow.com/questions/8748064/starting-activity-from-fragment-causes-nullpointerexception onClick View v Intent intent new Intent intent.setClass getActivity ActivityToStart.class startActivity intent return v And..
AlphabetIndexer with Custom Adapter managed by LoaderManager http://stackoverflow.com/questions/10224233/alphabetindexer-with-custom-adapter-managed-by-loadermanager '' String sortOrder ContactsContract.Contacts.DISPLAY_NAME COLLATE LOCALIZED ASC return new CursorLoader getActivity baseUri CONTACTS_SUMMARY_PROJECTION selection null sortOrder public void onLoadFinished Loader Cursor loader Cursor data.. R.id.contactInfo Create an empty adapter we will use to display the loaded data. mAdapter new ContactsCursorAdapter getActivity .getApplicationContext R.layout.contact_manager null from to setListAdapter mAdapter And if I comment the setFastScrollEnabled..
SimpleCursorTreeAdapter and CursorLoader for ExpandableListView http://stackoverflow.com/questions/10611927/simplecursortreeadapter-and-cursorloader-for-expandablelistview COLLATE LOCALIZED ASC String selectionArgs new String String.valueOf id cl new CursorLoader getActivity contactsUri CONTACTS_PROJECTION selection selectionArgs sortOrder else group cursor Uri groupsUri ContactsContract.Groups.CONTENT_SUMMARY_URI.. '' String sortOrder ContactsContract.Groups.TITLE COLLATE LOCALIZED ASC cl new CursorLoader getActivity groupsUri GROUPS_SUMMARY_PROJECTION selection null sortOrder return cl public void onLoadFinished Loader Cursor loader Cursor.. null Populate the contact list private void populateContactList Set up our adapter mAdapter new GroupsAdapter getActivity this android.R.layout.simple_expandable_list_item_1 android.R.layout.simple_expandable_list_item_1 new String ContactsContract.Groups.TITLE..
Jelly Bean DatePickerDialog — is there a way to cancel? http://stackoverflow.com/questions/11444238/jelly-bean-datepickerdialog-is-there-a-way-to-cancel DatePickerDialogFragment.DATE 17 DialogFragment picker new DatePickerDialogFragment picker.setArguments b picker.show getActivity .getSupportFragmentManager frag_date_picker And that's all it takes The reason I still keep my answer as accepted is because..
How to transfer the formatted date string from my DatePickerFragment? http://stackoverflow.com/questions/18211684/how-to-transfer-the-formatted-date-string-from-my-datepickerfragment day c.get Calendar.DAY_OF_MONTH Create a new instance of DatePickerDialog and return it return new DatePickerDialog getActivity this year month day @Override public void onDateSet DatePicker view int year int month int day Calendar c Calendar.getInstance.. int year c.get Calendar.YEAR int month c.get Calendar.MONTH int day c.get Calendar.DAY_OF_MONTH listener TheListener getActivity Create a new instance of DatePickerDialog and return it return new DatePickerDialog getActivity this year month day @Override.. listener TheListener getActivity Create a new instance of DatePickerDialog and return it return new DatePickerDialog getActivity this year month day @Override public void onDateSet DatePicker view int year int month int day Calendar c Calendar.getInstance..
How do I load a contact Photo? http://stackoverflow.com/questions/2383580/how-do-i-load-a-contact-photo String phoneNumber ... QuickContactBadge badge QuickContactBadge view.findViewById R.id.friend new QuickContactHelper getActivity badge phoneNumber .addThumbnail Now there are ways to be more efficient for example if you are rendering a message timeline..
Android keeps caching my intents Extras, how to declare a pending intent that keeps fresh extras? http://stackoverflow.com/questions/3140072/android-keeps-caching-my-intents-extras-how-to-declare-a-pending-intent-that-ke id Long.parseLong objContact.getId intent.putExtra results result.toArray PendingIntent contentIntent PendingIntent.getActivity context 0 intent 0 then this is used by a notification manager NotificationManager mNotificationManager NotificationManager.. them. intent.setAction actionstring System.currentTimeMillis UPDATE Also the lightly documented second parameter to getActivity and kin on PendingIntent apparently can be used to create distinct PendingIntent objects for the same underlying Intent..
MapView in a Fragment (Honeycomb) http://stackoverflow.com/questions/5109336/mapview-in-a-fragment-honeycomb MapView.java 247 My second idea was to create the MapView programmatically and pass the associated activity via getActivity as Context to the MapView constructor. Does not work E AndroidRuntime 834 Caused by java.lang.IllegalArgumentException MapViews..
ViewPager and fragments ??what's the right way to store fragment's state? http://stackoverflow.com/questions/7951730/viewpager-and-fragments-whats-the-right-way-to-store-fragments-state new LoadMessagesTask instantiate list of messages mMessagesList new ArrayList Message mAdapter new MessageArrayAdapter getActivity mMessagesList setListAdapter mAdapter @Override public void onResume mListener.onMessageInitialisation super.onResume public..
Starting Activity from Fragment causes NullPointerException http://stackoverflow.com/questions/8748064/starting-activity-from-fragment-causes-nullpointerexception new OnClickListener @Override public void onClick View v Intent intent new Intent intent.setClass getActivity ActivityToStart.class startActivity intent return v And this is my LogCat 01 05 19 39 00.913 E AndroidRuntime 10557..
|