wallpaper app doesn't show images from firebase
I'm making a wallpaper app and I'm trying to make category section with a category text over a wallpaper representing the category (Like Text - nature, picture - forest). The problem is, that nothing shows up when I play the app, but there is no errors as well, everything should be working fine, but it doesnt.
Firebase rules are all set up.
I've granted access to the internet for the app.
Dependencies:
dependencies {
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.firebaseui:firebase-ui-database:3.+'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-core:16.0.5'
}
Category fragment class:
public class CategoryFragment extends Fragment {
//Firebase
FirebaseDatabase database;
DatabaseReference categoryBackground;
//FirebaseUI adapteris
FirebaseRecyclerOptions<CategoryItem> options;
FirebaseRecyclerAdapter<CategoryItem, CategoryViewHolder> adapter;
//view
RecyclerView recyclerView;
private static CategoryFragment INSTANCE = null;
public CategoryFragment() {
// Required empty public constructor
database = FirebaseDatabase.getInstance();
categoryBackground = database.getReference(Common.STR_CATEGORY_BACKGROUND);
options = new FirebaseRecyclerOptions.Builder<CategoryItem>()
.setQuery(categoryBackground,CategoryItem.class)
.build();
adapter = new FirebaseRecyclerAdapter<CategoryItem, CategoryViewHolder>(options) {
@Override
protected void onBindViewHolder(@NonNull final CategoryViewHolder holder, int position, @NonNull final CategoryItem model) {
Picasso.get()
.load(model.getImageLink())
.networkPolicy(NetworkPolicy.OFFLINE)
.into(holder.background_image, new Callback() {
@Override
public void onSuccess() {
}
@Override
public void onError(Exception e) {
//Bandyti dar karta online jeigu nepavyksta
Picasso.get()
.load(model.getImageLink())
.error(R.drawable.ic_error_black_24dp)
.into(holder.background_image, new Callback() {
@Override
public void onSuccess() {
}
@Override
public void onError(Exception e) {
Log.e("ERROR_", "Couldn't fetch image");
}
});
}
});
holder.category_name.setText(model.getName());
holder.setItemClickListener(new ItemClickListener() {
@Override
public void onClick(View view, int position) {
}
});
}
@Override
public CategoryViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(parent.getContext())
.inflate(R.layout.layout_category_item, parent, false);
return new CategoryViewHolder(itemView);
}
};
}
public static CategoryFragment getInstance()
{
if(INSTANCE == null)
INSTANCE = new CategoryFragment();
return INSTANCE;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_category, container, false);
recyclerView = (RecyclerView)view.findViewById(R.id.recycler_category);
recyclerView.setHasFixedSize(true);
GridLayoutManager gridLayoutManager = new GridLayoutManager(getActivity(),2);
recyclerView.setLayoutManager((gridLayoutManager));
setCategory();
return view;
}
private void setCategory() {
adapter.startListening();
recyclerView.setAdapter(adapter);
}
@Override
public void onStart() {
super.onStart();
if(adapter != null)
adapter.startListening();
}
@Override
public void onStop() {
if(adapter != null)
adapter.stopListening();
super.onStop();
}
@Override
public void onResume() {
super.onResume();
if(adapter != null)
adapter.startListening();
}
}
java android-studio
add a comment |
I'm making a wallpaper app and I'm trying to make category section with a category text over a wallpaper representing the category (Like Text - nature, picture - forest). The problem is, that nothing shows up when I play the app, but there is no errors as well, everything should be working fine, but it doesnt.
Firebase rules are all set up.
I've granted access to the internet for the app.
Dependencies:
dependencies {
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.firebaseui:firebase-ui-database:3.+'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-core:16.0.5'
}
Category fragment class:
public class CategoryFragment extends Fragment {
//Firebase
FirebaseDatabase database;
DatabaseReference categoryBackground;
//FirebaseUI adapteris
FirebaseRecyclerOptions<CategoryItem> options;
FirebaseRecyclerAdapter<CategoryItem, CategoryViewHolder> adapter;
//view
RecyclerView recyclerView;
private static CategoryFragment INSTANCE = null;
public CategoryFragment() {
// Required empty public constructor
database = FirebaseDatabase.getInstance();
categoryBackground = database.getReference(Common.STR_CATEGORY_BACKGROUND);
options = new FirebaseRecyclerOptions.Builder<CategoryItem>()
.setQuery(categoryBackground,CategoryItem.class)
.build();
adapter = new FirebaseRecyclerAdapter<CategoryItem, CategoryViewHolder>(options) {
@Override
protected void onBindViewHolder(@NonNull final CategoryViewHolder holder, int position, @NonNull final CategoryItem model) {
Picasso.get()
.load(model.getImageLink())
.networkPolicy(NetworkPolicy.OFFLINE)
.into(holder.background_image, new Callback() {
@Override
public void onSuccess() {
}
@Override
public void onError(Exception e) {
//Bandyti dar karta online jeigu nepavyksta
Picasso.get()
.load(model.getImageLink())
.error(R.drawable.ic_error_black_24dp)
.into(holder.background_image, new Callback() {
@Override
public void onSuccess() {
}
@Override
public void onError(Exception e) {
Log.e("ERROR_", "Couldn't fetch image");
}
});
}
});
holder.category_name.setText(model.getName());
holder.setItemClickListener(new ItemClickListener() {
@Override
public void onClick(View view, int position) {
}
});
}
@Override
public CategoryViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(parent.getContext())
.inflate(R.layout.layout_category_item, parent, false);
return new CategoryViewHolder(itemView);
}
};
}
public static CategoryFragment getInstance()
{
if(INSTANCE == null)
INSTANCE = new CategoryFragment();
return INSTANCE;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_category, container, false);
recyclerView = (RecyclerView)view.findViewById(R.id.recycler_category);
recyclerView.setHasFixedSize(true);
GridLayoutManager gridLayoutManager = new GridLayoutManager(getActivity(),2);
recyclerView.setLayoutManager((gridLayoutManager));
setCategory();
return view;
}
private void setCategory() {
adapter.startListening();
recyclerView.setAdapter(adapter);
}
@Override
public void onStart() {
super.onStart();
if(adapter != null)
adapter.startListening();
}
@Override
public void onStop() {
if(adapter != null)
adapter.stopListening();
super.onStop();
}
@Override
public void onResume() {
super.onResume();
if(adapter != null)
adapter.startListening();
}
}
java android-studio
add a comment |
I'm making a wallpaper app and I'm trying to make category section with a category text over a wallpaper representing the category (Like Text - nature, picture - forest). The problem is, that nothing shows up when I play the app, but there is no errors as well, everything should be working fine, but it doesnt.
Firebase rules are all set up.
I've granted access to the internet for the app.
Dependencies:
dependencies {
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.firebaseui:firebase-ui-database:3.+'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-core:16.0.5'
}
Category fragment class:
public class CategoryFragment extends Fragment {
//Firebase
FirebaseDatabase database;
DatabaseReference categoryBackground;
//FirebaseUI adapteris
FirebaseRecyclerOptions<CategoryItem> options;
FirebaseRecyclerAdapter<CategoryItem, CategoryViewHolder> adapter;
//view
RecyclerView recyclerView;
private static CategoryFragment INSTANCE = null;
public CategoryFragment() {
// Required empty public constructor
database = FirebaseDatabase.getInstance();
categoryBackground = database.getReference(Common.STR_CATEGORY_BACKGROUND);
options = new FirebaseRecyclerOptions.Builder<CategoryItem>()
.setQuery(categoryBackground,CategoryItem.class)
.build();
adapter = new FirebaseRecyclerAdapter<CategoryItem, CategoryViewHolder>(options) {
@Override
protected void onBindViewHolder(@NonNull final CategoryViewHolder holder, int position, @NonNull final CategoryItem model) {
Picasso.get()
.load(model.getImageLink())
.networkPolicy(NetworkPolicy.OFFLINE)
.into(holder.background_image, new Callback() {
@Override
public void onSuccess() {
}
@Override
public void onError(Exception e) {
//Bandyti dar karta online jeigu nepavyksta
Picasso.get()
.load(model.getImageLink())
.error(R.drawable.ic_error_black_24dp)
.into(holder.background_image, new Callback() {
@Override
public void onSuccess() {
}
@Override
public void onError(Exception e) {
Log.e("ERROR_", "Couldn't fetch image");
}
});
}
});
holder.category_name.setText(model.getName());
holder.setItemClickListener(new ItemClickListener() {
@Override
public void onClick(View view, int position) {
}
});
}
@Override
public CategoryViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(parent.getContext())
.inflate(R.layout.layout_category_item, parent, false);
return new CategoryViewHolder(itemView);
}
};
}
public static CategoryFragment getInstance()
{
if(INSTANCE == null)
INSTANCE = new CategoryFragment();
return INSTANCE;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_category, container, false);
recyclerView = (RecyclerView)view.findViewById(R.id.recycler_category);
recyclerView.setHasFixedSize(true);
GridLayoutManager gridLayoutManager = new GridLayoutManager(getActivity(),2);
recyclerView.setLayoutManager((gridLayoutManager));
setCategory();
return view;
}
private void setCategory() {
adapter.startListening();
recyclerView.setAdapter(adapter);
}
@Override
public void onStart() {
super.onStart();
if(adapter != null)
adapter.startListening();
}
@Override
public void onStop() {
if(adapter != null)
adapter.stopListening();
super.onStop();
}
@Override
public void onResume() {
super.onResume();
if(adapter != null)
adapter.startListening();
}
}
java android-studio
I'm making a wallpaper app and I'm trying to make category section with a category text over a wallpaper representing the category (Like Text - nature, picture - forest). The problem is, that nothing shows up when I play the app, but there is no errors as well, everything should be working fine, but it doesnt.
Firebase rules are all set up.
I've granted access to the internet for the app.
Dependencies:
dependencies {
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.firebaseui:firebase-ui-database:3.+'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-core:16.0.5'
}
Category fragment class:
public class CategoryFragment extends Fragment {
//Firebase
FirebaseDatabase database;
DatabaseReference categoryBackground;
//FirebaseUI adapteris
FirebaseRecyclerOptions<CategoryItem> options;
FirebaseRecyclerAdapter<CategoryItem, CategoryViewHolder> adapter;
//view
RecyclerView recyclerView;
private static CategoryFragment INSTANCE = null;
public CategoryFragment() {
// Required empty public constructor
database = FirebaseDatabase.getInstance();
categoryBackground = database.getReference(Common.STR_CATEGORY_BACKGROUND);
options = new FirebaseRecyclerOptions.Builder<CategoryItem>()
.setQuery(categoryBackground,CategoryItem.class)
.build();
adapter = new FirebaseRecyclerAdapter<CategoryItem, CategoryViewHolder>(options) {
@Override
protected void onBindViewHolder(@NonNull final CategoryViewHolder holder, int position, @NonNull final CategoryItem model) {
Picasso.get()
.load(model.getImageLink())
.networkPolicy(NetworkPolicy.OFFLINE)
.into(holder.background_image, new Callback() {
@Override
public void onSuccess() {
}
@Override
public void onError(Exception e) {
//Bandyti dar karta online jeigu nepavyksta
Picasso.get()
.load(model.getImageLink())
.error(R.drawable.ic_error_black_24dp)
.into(holder.background_image, new Callback() {
@Override
public void onSuccess() {
}
@Override
public void onError(Exception e) {
Log.e("ERROR_", "Couldn't fetch image");
}
});
}
});
holder.category_name.setText(model.getName());
holder.setItemClickListener(new ItemClickListener() {
@Override
public void onClick(View view, int position) {
}
});
}
@Override
public CategoryViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(parent.getContext())
.inflate(R.layout.layout_category_item, parent, false);
return new CategoryViewHolder(itemView);
}
};
}
public static CategoryFragment getInstance()
{
if(INSTANCE == null)
INSTANCE = new CategoryFragment();
return INSTANCE;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_category, container, false);
recyclerView = (RecyclerView)view.findViewById(R.id.recycler_category);
recyclerView.setHasFixedSize(true);
GridLayoutManager gridLayoutManager = new GridLayoutManager(getActivity(),2);
recyclerView.setLayoutManager((gridLayoutManager));
setCategory();
return view;
}
private void setCategory() {
adapter.startListening();
recyclerView.setAdapter(adapter);
}
@Override
public void onStart() {
super.onStart();
if(adapter != null)
adapter.startListening();
}
@Override
public void onStop() {
if(adapter != null)
adapter.stopListening();
super.onStop();
}
@Override
public void onResume() {
super.onResume();
if(adapter != null)
adapter.startListening();
}
}
java android-studio
java android-studio
edited Nov 12 '18 at 12:24
AS Mackay
1,9334816
1,9334816
asked Nov 12 '18 at 12:05
Elvis
53
53
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Found a solution, I was sitting hours on this and didn't notice a spelling mistake in a string. Kill me.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53261829%2fwallpaper-app-doesnt-show-images-from-firebase%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Found a solution, I was sitting hours on this and didn't notice a spelling mistake in a string. Kill me.
add a comment |
Found a solution, I was sitting hours on this and didn't notice a spelling mistake in a string. Kill me.
add a comment |
Found a solution, I was sitting hours on this and didn't notice a spelling mistake in a string. Kill me.
Found a solution, I was sitting hours on this and didn't notice a spelling mistake in a string. Kill me.
answered Nov 12 '18 at 13:08
Elvis
53
53
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53261829%2fwallpaper-app-doesnt-show-images-from-firebase%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown