Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

android.content.res.Resources$NotFoundException: Resource ID #0x0 #140

Open
ameerhamza6733 opened this issue May 11, 2016 · 2 comments
Open

Comments

@ameerhamza6733
Copy link

ameerhamza6733 commented May 11, 2016

i got this error when i try to run code "android.content.res.Resources$NotFoundException: Resource ID #0x0" any idea why?
here is my .xml

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"

app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/activity_main"
tools:context=".MainActivity">




    <com.dexafree.materialList.view.MaterialListView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:id="@+id/material_listview"/>


​

here is my main activity

FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@OverRide
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
MaterialListView mListView = (MaterialListView) findViewById(R.id.material_listview);
Card card = new Card.Builder(MainActivity.this)
.setTag("BASIC_IMAGE_BUTTONS_CARD")
.withProvider(new CardProvider<>())
.setTitle("I'm new")
.setDescription("I've been generated on runtime!")
.setDrawable(R.drawable.myimage)
.endConfig()
.build();
mListView.getAdapter().add(card);
}
});

@FHellmann
Copy link
Contributor

You got this error due to the fact, that you have'nt defined a layout for the card you want to add to the MaterialListView.

Card card = new Card.Builder(MainActivity.this)
.setTag("BASIC_IMAGE_BUTTONS_CARD")
.withProvider(new CardProvider())
.setLayout(...) // TODO: Here comes your R.layout.xyz (for example: R.layout.material_basic_image_buttons_card_layout)
.setTitle("I'm new")
.setDescription("I've been generated on runtime!")
.setDrawable(R.drawable.myimage)
.endConfig()
.build();

@ameerhamza6733
Copy link
Author

thanks mate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants