Below is the code invoked onItemSelected in a spinner. At times I am getting a null pointer exception even when the app is closed. The image of the bug is attached in this post.
/**
* Store the selected product
* @param parent
* @param view
* @param position
* @param id
*/
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
QuickListItem selectedSpinnerProduct = productAdapter.getItem(position);
if (selectedSpinnerProduct != null) {
mgrApp.storeSharedPrefLong(ConstantsQuickList.SHARED_PREF_PRODUCT_ID,
selectedSpinnerProduct.getId());
}
SpannableStringBuilder builder = getPendingCallCount(products,
selectedSpinnerProduct);
((TextView) view).setText(builder, TextView.BufferType.SPANNABLE);
//Hide the performance tracker as product will change
ViewProspects.crdvPerformanceTracker.setVisibility(View.GONE);
populateSalesTracker(typeOfOperation,ConstantsProspects.INVALID_STRING);
}