Skip to content

Instantly share code, notes, and snippets.

@px-amaac
Last active August 29, 2015 14:11
Show Gist options
  • Save px-amaac/d03eaacd553190424793 to your computer and use it in GitHub Desktop.
Save px-amaac/d03eaacd553190424793 to your computer and use it in GitHub Desktop.
Error message
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
View root = inflater.inflate(R.layout.activity_staggered_grid, container, false);
mGridView = (StaggeredGridView) root.findViewById(R.id.grid_view);
createOrRestoreGridData(savedInstanceState);
mGridView.setOnItemClickListener(this);
mGridView.setOnScrollListener(this);
return root;
}
public class FeaturedFragment extends BaseStaggeredGridFragment<Offer> {
private static final String TAG = FeaturedFragment.class.getSimpleName();
private static final String SAVED_BANNER_TAG = FeaturedFragment.class.getSimpleName() + "_BANNER";
public static final int POSITION = 0;
private Market mMarket;
private View mHeaderView;
public static FeaturedFragment newInstance(Market market) {
FeaturedFragment newFrag = new FeaturedFragment();
Bundle args = new Bundle();
args.putParcelable(MARKET_DATA_KEY, market);
newFrag.setArguments(args);
return newFrag;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View root = super.onCreateView(inflater, container, savedInstanceState);
if(mAdapter == null) {
mAdapter = new StaggeredBaseAdapter<Offer>(getActivity(), Picasso.with(getActivity()), R.layout.offer_leaf );
}
mAppState = getResources().getStringArray(R.array.main_activity_tracking)[POSITION];
mTabPosition = POSITION;
return root;
}
@Override public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mHeaderView = getActivity().getLayoutInflater().inflate(R.layout.featured_header, null);
mGridView.addHeaderView(mHeaderView);
BaseWebviewFragment headerWebview = (BaseWebviewFragment) getChildFragmentManager()
.findFragmentById(R.id.featured_banner_fragment);
if (headerWebview == null) {
headerWebview = new BaseWebviewFragment();
FragmentTransaction transaction = getChildFragmentManager()
.beginTransaction();
transaction.add(R.id.featured_banner_fragment, headerWebview).commit();
}
}
private void loadBannerUrl(String url) {
BaseWebviewFragment fragment =
(BaseWebviewFragment) getChildFragmentManager().findFragmentById(R.id.featured_banner_fragment);
fragment.updateCurrentUrl(url);
}
@Override
public void onResume() {
super.onResume();
Bundle bundle = getArguments();
String url = NotificationHelper.appendContextParamsForCampaign(getActivity(), getActivity().getString(R.string.banner_url));
if(!TextUtils.isEmpty(url)) {
loadBannerUrl(url);
}
mGridView.setAdapter(mAdapter);
mMarket = bundle.getParcelable(MARKET_DATA_KEY);
if(mMarket != null) {
if (mData != null && !mData.isEmpty()) {
checkAdapter();
} else if(!mHasRequestedMore) {
offset = 0;
featuredAPICall(offset);
mHasRequestedMore = true;
}
}
}
12-16 16:13:13.605 16077-16077/com.staging E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.staging, PID: 16077
java.lang.IllegalArgumentException: No view found for id 0x7f09009e (staging:id/featured_banner_fragment) for fragment BaseWebviewFragment{42fc9768 #0 id=0x7f09009e}
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:930)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1115)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1478)
at android.support.v4.app.Fragment.performStart(Fragment.java:1521)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:968)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1115)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1478)
at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:478)
at android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:163)
at android.support.v4.view.ViewPager.populate(ViewPager.java:1068)
at android.support.v4.view.ViewPager.populate(ViewPager.java:914)
at android.support.v4.view.ViewPager.setAdapter(ViewPager.java:442)
at com.activities.MainActivity.initFragments(MainActivity.java:107)
at com.activities.MainActivity.access$400(MainActivity.java:43)
at com.activities.MainActivity$ParseMarketTask.onPostExecute(MainActivity.java:228)
at com.wanderful.findnsave.activities.MainActivity$ParseMarketTask.onPostExecute(MainActivity.java:194)
at android.os.AsyncTask.finish(AsyncTask.java:632)
at android.os.AsyncTask.access$600(AsyncTask.java:177)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5356)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
at dalvik.system.NativeStart.main(Native Method)
private void initFragments(){
Intent intent = getIntent();
int position = intent.getIntExtra(FRAGMENT_POSITION_EXTRA_KEY, mCurrentPage);
mProgressBar = (ProgressBar) findViewById(R.id.progress_bar);
PagerSlidingTabStrip tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs);
mPager = (ViewPager) findViewById(R.id.pager);
mPager.setOffscreenPageLimit(3);
mAdapter = new NavPagerAdapter(getResources().getStringArray(R.array.tab_titles), mLocation, mMarket, getSupportFragmentManager());
//set the adapter to the pager
//Error is here/////////////////////////////
mPager.setAdapter(mAdapter); //line 107
////////////////////////////////////////////////////////
mPager.setCurrentItem(position);
tabs.setViewPager(mPager);
tabs.setTextSize(MyUtils.spToPixels(this, 12));
tabs.setOnPageChangeListener(this);
mProgressBar.setVisibility(View.GONE);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment