Searching Contents in Firebase Live DatabaseShip an application with a databaseproblem with Android requestFocus()Why does EditText retain its Activity's Context in Ice Cream SandwichEditText & Enter keyListView ImageButton Set RingtoneGet children using orderByChild-equalsTo in Firebase-AndroidAdding Social Media Share Logic From Firebase in AndroidSearch Firestore query don't show data in RecycleViewWhy onBindViewHolder index isn't incrementing in Recycler View?How to add child(Product) under a child(Store) in Firebase Database using RecyclerView
Can a planet's magnetic field be generated by non-ferromagnetic metals?
What happens to a Bladesinger reincarnated as a Human?
How might people try to stop the world becoming a rogue planet?
Why does Bane's stock exchange robbery actually work to bankrupt Bruce Wayne?
Why are the Ukraine related congressional hearings behind closed doors?
Is "I can eat a glass" a good translation of "私はガラスを食べられます"?
Is a new blessing required when taking off and putting back on your tallit?
How are letters between governments being transported and delivered?
How could a sequence of random dates be generated, given year interval?
can't upgrade from kubuntu 19.04 to 19.10
A partially ugly group with a casual secret
Iterator for traversing a tree [v2]
Is dark matter inside galaxies different from dark matter in intergalactic space?
Problem aligning two alphabets
More elegant way to express ((x == a and y == b) or (x == b and y == a))?
Why are my plastic credit card and activation code sent separately?
Decay of spin-1/2 particle into two spin-1/2 particles
Hell0 W0rld! scored by ASCII values
We know someone is scrying on us. Is there anything we can do about it?
Command which removes data left side of ";" (semicolon) on each row
Why does the SR-71 Blackbird sometimes have dents in the nose?
My bike's adjustable stem keeps falling down
How much caffeine would there be if I reuse tea leaves in a second brewing?
Can tankless & conventional water heaters join forces?
Searching Contents in Firebase Live Database
Ship an application with a databaseproblem with Android requestFocus()Why does EditText retain its Activity's Context in Ice Cream SandwichEditText & Enter keyListView ImageButton Set RingtoneGet children using orderByChild-equalsTo in Firebase-AndroidAdding Social Media Share Logic From Firebase in AndroidSearch Firestore query don't show data in RecycleViewWhy onBindViewHolder index isn't incrementing in Recycler View?How to add child(Product) under a child(Store) in Firebase Database using RecyclerView
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;
When I search for items in my firebase database, I am not getting an error but instead no value at all. When going through the debugger, the values I have in the editText are infact being set and when searching for those values in the Query, they aren't showing up:
final EditText t = (EditText) findViewById(R.id.DjNameET);
mProfileDatabase = FirebaseDatabase.getInstance().getReference();
t.setOnEditorActionListener(new TextView.OnEditorActionListener()
@Override
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent)
if(i == EditorInfo.IME_ACTION_SEARCH)
searchData = t.getText().toString();
return true;
return false;
);
ImageButton imgB= (ImageButton) findViewById(R.id.searchBtn);
imgB.setOnClickListener(new View.OnClickListener()
@Override
public void onClick(View view)
query = mProfileDatabase.child("djprofile").orderByChild("djName")
.startAt(searchData)
.endAt(searchData + "uf8ff");
FirebaseRecyclerOptions<DjProfile> firebaseRecyclerOptions = new FirebaseRecyclerOptions.Builder<DjProfile>()
.setQuery(query, DjProfile.class)
.build();
firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<DjProfile, ResultsViewHolder>(firebaseRecyclerOptions)
@NonNull
@Override
public ResultsViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i)
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.searchitem_list, viewGroup, false);
return new ResultsViewHolder(view);
@Override
protected void onBindViewHolder(@NonNull ResultsViewHolder holder, int position, @NonNull DjProfile model)
holder.setDjProfile(model);
;
firebaseRecyclerAdapter.startListening();
recyclerView.setAdapter(firebaseRecyclerAdapter);
);
Here is what the live database looks like:
In my edit text when I search for "DjRockSauce" no results are shown within the recyclerview, I have a feeling this is because I am not getting the correct path into the query, if this is the case how do I correctly get the file paths for searching and displaying results?
android firebase-realtime-database
add a comment
|
When I search for items in my firebase database, I am not getting an error but instead no value at all. When going through the debugger, the values I have in the editText are infact being set and when searching for those values in the Query, they aren't showing up:
final EditText t = (EditText) findViewById(R.id.DjNameET);
mProfileDatabase = FirebaseDatabase.getInstance().getReference();
t.setOnEditorActionListener(new TextView.OnEditorActionListener()
@Override
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent)
if(i == EditorInfo.IME_ACTION_SEARCH)
searchData = t.getText().toString();
return true;
return false;
);
ImageButton imgB= (ImageButton) findViewById(R.id.searchBtn);
imgB.setOnClickListener(new View.OnClickListener()
@Override
public void onClick(View view)
query = mProfileDatabase.child("djprofile").orderByChild("djName")
.startAt(searchData)
.endAt(searchData + "uf8ff");
FirebaseRecyclerOptions<DjProfile> firebaseRecyclerOptions = new FirebaseRecyclerOptions.Builder<DjProfile>()
.setQuery(query, DjProfile.class)
.build();
firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<DjProfile, ResultsViewHolder>(firebaseRecyclerOptions)
@NonNull
@Override
public ResultsViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i)
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.searchitem_list, viewGroup, false);
return new ResultsViewHolder(view);
@Override
protected void onBindViewHolder(@NonNull ResultsViewHolder holder, int position, @NonNull DjProfile model)
holder.setDjProfile(model);
;
firebaseRecyclerAdapter.startListening();
recyclerView.setAdapter(firebaseRecyclerAdapter);
);
Here is what the live database looks like:
In my edit text when I search for "DjRockSauce" no results are shown within the recyclerview, I have a feeling this is because I am not getting the correct path into the query, if this is the case how do I correctly get the file paths for searching and displaying results?
android firebase-realtime-database
ThemProfileDatabase.child("djprofile").orderByChild("djName")
looks good to me. If you remove theorderByChild().startAt().endAt()
, does it show all child nodes?
– Frank van Puffelen
Mar 28 at 22:17
Yes it does, I just checked now
– beastlyCoder
Mar 28 at 22:19
So in that case the path is correct, and the problem is in the order/filter. If you hardcode the search terms (so.orderByChild("djName").startAt("Dj").endAt("Djuf8ff");
), does it work?
– Frank van Puffelen
Mar 28 at 22:27
Ha! Yes that also works
– beastlyCoder
Mar 28 at 22:29
I printed a toast message of the string I am passing through to my startAt() and endAt() methods and it is null, I am going to find a way to get the actual value
– beastlyCoder
Mar 28 at 22:33
add a comment
|
When I search for items in my firebase database, I am not getting an error but instead no value at all. When going through the debugger, the values I have in the editText are infact being set and when searching for those values in the Query, they aren't showing up:
final EditText t = (EditText) findViewById(R.id.DjNameET);
mProfileDatabase = FirebaseDatabase.getInstance().getReference();
t.setOnEditorActionListener(new TextView.OnEditorActionListener()
@Override
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent)
if(i == EditorInfo.IME_ACTION_SEARCH)
searchData = t.getText().toString();
return true;
return false;
);
ImageButton imgB= (ImageButton) findViewById(R.id.searchBtn);
imgB.setOnClickListener(new View.OnClickListener()
@Override
public void onClick(View view)
query = mProfileDatabase.child("djprofile").orderByChild("djName")
.startAt(searchData)
.endAt(searchData + "uf8ff");
FirebaseRecyclerOptions<DjProfile> firebaseRecyclerOptions = new FirebaseRecyclerOptions.Builder<DjProfile>()
.setQuery(query, DjProfile.class)
.build();
firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<DjProfile, ResultsViewHolder>(firebaseRecyclerOptions)
@NonNull
@Override
public ResultsViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i)
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.searchitem_list, viewGroup, false);
return new ResultsViewHolder(view);
@Override
protected void onBindViewHolder(@NonNull ResultsViewHolder holder, int position, @NonNull DjProfile model)
holder.setDjProfile(model);
;
firebaseRecyclerAdapter.startListening();
recyclerView.setAdapter(firebaseRecyclerAdapter);
);
Here is what the live database looks like:
In my edit text when I search for "DjRockSauce" no results are shown within the recyclerview, I have a feeling this is because I am not getting the correct path into the query, if this is the case how do I correctly get the file paths for searching and displaying results?
android firebase-realtime-database
When I search for items in my firebase database, I am not getting an error but instead no value at all. When going through the debugger, the values I have in the editText are infact being set and when searching for those values in the Query, they aren't showing up:
final EditText t = (EditText) findViewById(R.id.DjNameET);
mProfileDatabase = FirebaseDatabase.getInstance().getReference();
t.setOnEditorActionListener(new TextView.OnEditorActionListener()
@Override
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent)
if(i == EditorInfo.IME_ACTION_SEARCH)
searchData = t.getText().toString();
return true;
return false;
);
ImageButton imgB= (ImageButton) findViewById(R.id.searchBtn);
imgB.setOnClickListener(new View.OnClickListener()
@Override
public void onClick(View view)
query = mProfileDatabase.child("djprofile").orderByChild("djName")
.startAt(searchData)
.endAt(searchData + "uf8ff");
FirebaseRecyclerOptions<DjProfile> firebaseRecyclerOptions = new FirebaseRecyclerOptions.Builder<DjProfile>()
.setQuery(query, DjProfile.class)
.build();
firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<DjProfile, ResultsViewHolder>(firebaseRecyclerOptions)
@NonNull
@Override
public ResultsViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i)
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.searchitem_list, viewGroup, false);
return new ResultsViewHolder(view);
@Override
protected void onBindViewHolder(@NonNull ResultsViewHolder holder, int position, @NonNull DjProfile model)
holder.setDjProfile(model);
;
firebaseRecyclerAdapter.startListening();
recyclerView.setAdapter(firebaseRecyclerAdapter);
);
Here is what the live database looks like:
In my edit text when I search for "DjRockSauce" no results are shown within the recyclerview, I have a feeling this is because I am not getting the correct path into the query, if this is the case how do I correctly get the file paths for searching and displaying results?
android firebase-realtime-database
android firebase-realtime-database
asked Mar 28 at 21:36
beastlyCoderbeastlyCoder
1,0821 gold badge11 silver badges34 bronze badges
1,0821 gold badge11 silver badges34 bronze badges
ThemProfileDatabase.child("djprofile").orderByChild("djName")
looks good to me. If you remove theorderByChild().startAt().endAt()
, does it show all child nodes?
– Frank van Puffelen
Mar 28 at 22:17
Yes it does, I just checked now
– beastlyCoder
Mar 28 at 22:19
So in that case the path is correct, and the problem is in the order/filter. If you hardcode the search terms (so.orderByChild("djName").startAt("Dj").endAt("Djuf8ff");
), does it work?
– Frank van Puffelen
Mar 28 at 22:27
Ha! Yes that also works
– beastlyCoder
Mar 28 at 22:29
I printed a toast message of the string I am passing through to my startAt() and endAt() methods and it is null, I am going to find a way to get the actual value
– beastlyCoder
Mar 28 at 22:33
add a comment
|
ThemProfileDatabase.child("djprofile").orderByChild("djName")
looks good to me. If you remove theorderByChild().startAt().endAt()
, does it show all child nodes?
– Frank van Puffelen
Mar 28 at 22:17
Yes it does, I just checked now
– beastlyCoder
Mar 28 at 22:19
So in that case the path is correct, and the problem is in the order/filter. If you hardcode the search terms (so.orderByChild("djName").startAt("Dj").endAt("Djuf8ff");
), does it work?
– Frank van Puffelen
Mar 28 at 22:27
Ha! Yes that also works
– beastlyCoder
Mar 28 at 22:29
I printed a toast message of the string I am passing through to my startAt() and endAt() methods and it is null, I am going to find a way to get the actual value
– beastlyCoder
Mar 28 at 22:33
The
mProfileDatabase.child("djprofile").orderByChild("djName")
looks good to me. If you remove the orderByChild().startAt().endAt()
, does it show all child nodes?– Frank van Puffelen
Mar 28 at 22:17
The
mProfileDatabase.child("djprofile").orderByChild("djName")
looks good to me. If you remove the orderByChild().startAt().endAt()
, does it show all child nodes?– Frank van Puffelen
Mar 28 at 22:17
Yes it does, I just checked now
– beastlyCoder
Mar 28 at 22:19
Yes it does, I just checked now
– beastlyCoder
Mar 28 at 22:19
So in that case the path is correct, and the problem is in the order/filter. If you hardcode the search terms (so
.orderByChild("djName").startAt("Dj").endAt("Djuf8ff");
), does it work?– Frank van Puffelen
Mar 28 at 22:27
So in that case the path is correct, and the problem is in the order/filter. If you hardcode the search terms (so
.orderByChild("djName").startAt("Dj").endAt("Djuf8ff");
), does it work?– Frank van Puffelen
Mar 28 at 22:27
Ha! Yes that also works
– beastlyCoder
Mar 28 at 22:29
Ha! Yes that also works
– beastlyCoder
Mar 28 at 22:29
I printed a toast message of the string I am passing through to my startAt() and endAt() methods and it is null, I am going to find a way to get the actual value
– beastlyCoder
Mar 28 at 22:33
I printed a toast message of the string I am passing through to my startAt() and endAt() methods and it is null, I am going to find a way to get the actual value
– beastlyCoder
Mar 28 at 22:33
add a comment
|
2 Answers
2
active
oldest
votes
When you have a problem like this, the right approach is to try to find where the problem is, and where it isn't.
The first step could be to see if you can show the unfiltered profiles.
query = mProfileDatabase.child("djprofile");
If this shows all profiles, you know that the path you build is correct.
If that is the case, I'd try with a hard-coded search string:
query = mProfileDatabase.child("djprofile").orderByChild("djName")
.startAt("Dr")
.endAt("Druf8ff");
If that works too, the problem is in how you get the search term, and you should be looking into that.
add a comment
|
Figured out with the help of @Frank van Puffelen, that my issue was I was calling searchText, and it was returning null. When in fact I needed to pass the physical EditText name's text into the search query as follows:
query = mProfileDatabase.child("djprofile").orderByChild("djName")
.startAt(t.getText().toString()).endAt(t.getText().toString() + "uf8ff");
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/4.0/"u003ecc by-sa 4.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%2f55407220%2fsearching-contents-in-firebase-live-database%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
When you have a problem like this, the right approach is to try to find where the problem is, and where it isn't.
The first step could be to see if you can show the unfiltered profiles.
query = mProfileDatabase.child("djprofile");
If this shows all profiles, you know that the path you build is correct.
If that is the case, I'd try with a hard-coded search string:
query = mProfileDatabase.child("djprofile").orderByChild("djName")
.startAt("Dr")
.endAt("Druf8ff");
If that works too, the problem is in how you get the search term, and you should be looking into that.
add a comment
|
When you have a problem like this, the right approach is to try to find where the problem is, and where it isn't.
The first step could be to see if you can show the unfiltered profiles.
query = mProfileDatabase.child("djprofile");
If this shows all profiles, you know that the path you build is correct.
If that is the case, I'd try with a hard-coded search string:
query = mProfileDatabase.child("djprofile").orderByChild("djName")
.startAt("Dr")
.endAt("Druf8ff");
If that works too, the problem is in how you get the search term, and you should be looking into that.
add a comment
|
When you have a problem like this, the right approach is to try to find where the problem is, and where it isn't.
The first step could be to see if you can show the unfiltered profiles.
query = mProfileDatabase.child("djprofile");
If this shows all profiles, you know that the path you build is correct.
If that is the case, I'd try with a hard-coded search string:
query = mProfileDatabase.child("djprofile").orderByChild("djName")
.startAt("Dr")
.endAt("Druf8ff");
If that works too, the problem is in how you get the search term, and you should be looking into that.
When you have a problem like this, the right approach is to try to find where the problem is, and where it isn't.
The first step could be to see if you can show the unfiltered profiles.
query = mProfileDatabase.child("djprofile");
If this shows all profiles, you know that the path you build is correct.
If that is the case, I'd try with a hard-coded search string:
query = mProfileDatabase.child("djprofile").orderByChild("djName")
.startAt("Dr")
.endAt("Druf8ff");
If that works too, the problem is in how you get the search term, and you should be looking into that.
answered Mar 28 at 22:50
Frank van PuffelenFrank van Puffelen
281k37 gold badges453 silver badges474 bronze badges
281k37 gold badges453 silver badges474 bronze badges
add a comment
|
add a comment
|
Figured out with the help of @Frank van Puffelen, that my issue was I was calling searchText, and it was returning null. When in fact I needed to pass the physical EditText name's text into the search query as follows:
query = mProfileDatabase.child("djprofile").orderByChild("djName")
.startAt(t.getText().toString()).endAt(t.getText().toString() + "uf8ff");
add a comment
|
Figured out with the help of @Frank van Puffelen, that my issue was I was calling searchText, and it was returning null. When in fact I needed to pass the physical EditText name's text into the search query as follows:
query = mProfileDatabase.child("djprofile").orderByChild("djName")
.startAt(t.getText().toString()).endAt(t.getText().toString() + "uf8ff");
add a comment
|
Figured out with the help of @Frank van Puffelen, that my issue was I was calling searchText, and it was returning null. When in fact I needed to pass the physical EditText name's text into the search query as follows:
query = mProfileDatabase.child("djprofile").orderByChild("djName")
.startAt(t.getText().toString()).endAt(t.getText().toString() + "uf8ff");
Figured out with the help of @Frank van Puffelen, that my issue was I was calling searchText, and it was returning null. When in fact I needed to pass the physical EditText name's text into the search query as follows:
query = mProfileDatabase.child("djprofile").orderByChild("djName")
.startAt(t.getText().toString()).endAt(t.getText().toString() + "uf8ff");
answered Mar 28 at 22:51
beastlyCoderbeastlyCoder
1,0821 gold badge11 silver badges34 bronze badges
1,0821 gold badge11 silver badges34 bronze badges
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.
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%2f55407220%2fsearching-contents-in-firebase-live-database%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
The
mProfileDatabase.child("djprofile").orderByChild("djName")
looks good to me. If you remove theorderByChild().startAt().endAt()
, does it show all child nodes?– Frank van Puffelen
Mar 28 at 22:17
Yes it does, I just checked now
– beastlyCoder
Mar 28 at 22:19
So in that case the path is correct, and the problem is in the order/filter. If you hardcode the search terms (so
.orderByChild("djName").startAt("Dj").endAt("Djuf8ff");
), does it work?– Frank van Puffelen
Mar 28 at 22:27
Ha! Yes that also works
– beastlyCoder
Mar 28 at 22:29
I printed a toast message of the string I am passing through to my startAt() and endAt() methods and it is null, I am going to find a way to get the actual value
– beastlyCoder
Mar 28 at 22:33