How can I display the category between example(3 and 7) in firebase?










1















How can I display the category between (example)(3 and 7) in firebase ?



foodList.orderByChild("menuId").startAt(3).endAt(7).equalTo(categoryID)


this is my code :



private void loadListFood(String categoryID) 
adapter = new FirebaseRecyclerAdapter<Food, FoodViewHolder>(Food.class,R.layout.food_item,FoodViewHolder.class,
foodList.orderByChild("menuId").startAt(3).endAt(7).equalTo(categoryID)

)
@Override
protected void populateViewHolder(FoodViewHolder viewHolder, Food model, int position)


viewHolder.food_name.setText(model.getName());
viewHolder.food_time.setText(model.getPrice());
Picasso.with(getBaseContext()).load(model.getImage()).into(viewHolder.food_image);
mDialog.dismiss();
final Food local = model ;
viewHolder.setItemClickListener(new ItemClickListener()
@Override
public void onClick(View view, int position, boolean isLongClick)
Intent intent = new Intent(FoodList.this,FoodDetail.class);
intent.putExtra("FoodId",adapter.getRef(position).getKey());
startActivity(intent);

);


;

recyclerView.setAdapter(adapter);



error message :



11-14 13:19:34.636 8233-8233/com.pro.ijdev.proapp E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.pro.ijdev.proapp, PID: 8233
java.lang.RuntimeException: Unable to start activity ComponentInfocom.pro.ijdev.proapp/com.pro.ijdev.proapp.FoodList: java.lang.IllegalArgumentException: Can't call equalTo() and startAt() combined
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.IllegalArgumentException: Can't call equalTo() and startAt() combined
at com.google.firebase.database.Query.zze(Unknown Source:12)
at com.google.firebase.database.Query.equalTo(Unknown Source:0)
at com.pro.ijdev.proapp.FoodList.loadListFood(FoodList.java:63)
at com.pro.ijdev.proapp.FoodList.onCreate(FoodList.java:53)
at android.app.Activity.performCreate(Activity.java:7009)
at android.app.Activity.performCreate(Activity.java:7000)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856) 
at android.app.ActivityThread.-wrap11(Unknown Source:0) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:164) 
at android.app.ActivityThread.main(ActivityThread.java:6494) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 









share|improve this question



















  • 1





    What is the current behaviour with the above code?

    – Dean coakley
    Nov 14 '18 at 0:34











  • @Deancoakley : Exception :D

    – ahmed asi
    Nov 14 '18 at 1:06






  • 1





    Can you attach your firebase structure. It's difficult to tell what's happening without that. And also, post what exception are you getting.

    – PradyumanDixit
    Nov 14 '18 at 3:53







  • 1





    @IbrahimHJabaly Keep in mind that Stack Overflow is an incredibly inefficient interactive debugger. If you get an exception, copy/paste the exact error message and stack trace into your question, so that we can see what you're getting.

    – Frank van Puffelen
    Nov 14 '18 at 4:34











  • Eng @FrankvanPuffelen : Done , I putted the error message .

    – ahmed asi
    Nov 14 '18 at 11:25















1















How can I display the category between (example)(3 and 7) in firebase ?



foodList.orderByChild("menuId").startAt(3).endAt(7).equalTo(categoryID)


this is my code :



private void loadListFood(String categoryID) 
adapter = new FirebaseRecyclerAdapter<Food, FoodViewHolder>(Food.class,R.layout.food_item,FoodViewHolder.class,
foodList.orderByChild("menuId").startAt(3).endAt(7).equalTo(categoryID)

)
@Override
protected void populateViewHolder(FoodViewHolder viewHolder, Food model, int position)


viewHolder.food_name.setText(model.getName());
viewHolder.food_time.setText(model.getPrice());
Picasso.with(getBaseContext()).load(model.getImage()).into(viewHolder.food_image);
mDialog.dismiss();
final Food local = model ;
viewHolder.setItemClickListener(new ItemClickListener()
@Override
public void onClick(View view, int position, boolean isLongClick)
Intent intent = new Intent(FoodList.this,FoodDetail.class);
intent.putExtra("FoodId",adapter.getRef(position).getKey());
startActivity(intent);

);


;

recyclerView.setAdapter(adapter);



error message :



11-14 13:19:34.636 8233-8233/com.pro.ijdev.proapp E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.pro.ijdev.proapp, PID: 8233
java.lang.RuntimeException: Unable to start activity ComponentInfocom.pro.ijdev.proapp/com.pro.ijdev.proapp.FoodList: java.lang.IllegalArgumentException: Can't call equalTo() and startAt() combined
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.IllegalArgumentException: Can't call equalTo() and startAt() combined
at com.google.firebase.database.Query.zze(Unknown Source:12)
at com.google.firebase.database.Query.equalTo(Unknown Source:0)
at com.pro.ijdev.proapp.FoodList.loadListFood(FoodList.java:63)
at com.pro.ijdev.proapp.FoodList.onCreate(FoodList.java:53)
at android.app.Activity.performCreate(Activity.java:7009)
at android.app.Activity.performCreate(Activity.java:7000)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856) 
at android.app.ActivityThread.-wrap11(Unknown Source:0) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:164) 
at android.app.ActivityThread.main(ActivityThread.java:6494) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 









share|improve this question



















  • 1





    What is the current behaviour with the above code?

    – Dean coakley
    Nov 14 '18 at 0:34











  • @Deancoakley : Exception :D

    – ahmed asi
    Nov 14 '18 at 1:06






  • 1





    Can you attach your firebase structure. It's difficult to tell what's happening without that. And also, post what exception are you getting.

    – PradyumanDixit
    Nov 14 '18 at 3:53







  • 1





    @IbrahimHJabaly Keep in mind that Stack Overflow is an incredibly inefficient interactive debugger. If you get an exception, copy/paste the exact error message and stack trace into your question, so that we can see what you're getting.

    – Frank van Puffelen
    Nov 14 '18 at 4:34











  • Eng @FrankvanPuffelen : Done , I putted the error message .

    – ahmed asi
    Nov 14 '18 at 11:25













1












1








1








How can I display the category between (example)(3 and 7) in firebase ?



foodList.orderByChild("menuId").startAt(3).endAt(7).equalTo(categoryID)


this is my code :



private void loadListFood(String categoryID) 
adapter = new FirebaseRecyclerAdapter<Food, FoodViewHolder>(Food.class,R.layout.food_item,FoodViewHolder.class,
foodList.orderByChild("menuId").startAt(3).endAt(7).equalTo(categoryID)

)
@Override
protected void populateViewHolder(FoodViewHolder viewHolder, Food model, int position)


viewHolder.food_name.setText(model.getName());
viewHolder.food_time.setText(model.getPrice());
Picasso.with(getBaseContext()).load(model.getImage()).into(viewHolder.food_image);
mDialog.dismiss();
final Food local = model ;
viewHolder.setItemClickListener(new ItemClickListener()
@Override
public void onClick(View view, int position, boolean isLongClick)
Intent intent = new Intent(FoodList.this,FoodDetail.class);
intent.putExtra("FoodId",adapter.getRef(position).getKey());
startActivity(intent);

);


;

recyclerView.setAdapter(adapter);



error message :



11-14 13:19:34.636 8233-8233/com.pro.ijdev.proapp E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.pro.ijdev.proapp, PID: 8233
java.lang.RuntimeException: Unable to start activity ComponentInfocom.pro.ijdev.proapp/com.pro.ijdev.proapp.FoodList: java.lang.IllegalArgumentException: Can't call equalTo() and startAt() combined
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.IllegalArgumentException: Can't call equalTo() and startAt() combined
at com.google.firebase.database.Query.zze(Unknown Source:12)
at com.google.firebase.database.Query.equalTo(Unknown Source:0)
at com.pro.ijdev.proapp.FoodList.loadListFood(FoodList.java:63)
at com.pro.ijdev.proapp.FoodList.onCreate(FoodList.java:53)
at android.app.Activity.performCreate(Activity.java:7009)
at android.app.Activity.performCreate(Activity.java:7000)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856) 
at android.app.ActivityThread.-wrap11(Unknown Source:0) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:164) 
at android.app.ActivityThread.main(ActivityThread.java:6494) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 









share|improve this question
















How can I display the category between (example)(3 and 7) in firebase ?



foodList.orderByChild("menuId").startAt(3).endAt(7).equalTo(categoryID)


this is my code :



private void loadListFood(String categoryID) 
adapter = new FirebaseRecyclerAdapter<Food, FoodViewHolder>(Food.class,R.layout.food_item,FoodViewHolder.class,
foodList.orderByChild("menuId").startAt(3).endAt(7).equalTo(categoryID)

)
@Override
protected void populateViewHolder(FoodViewHolder viewHolder, Food model, int position)


viewHolder.food_name.setText(model.getName());
viewHolder.food_time.setText(model.getPrice());
Picasso.with(getBaseContext()).load(model.getImage()).into(viewHolder.food_image);
mDialog.dismiss();
final Food local = model ;
viewHolder.setItemClickListener(new ItemClickListener()
@Override
public void onClick(View view, int position, boolean isLongClick)
Intent intent = new Intent(FoodList.this,FoodDetail.class);
intent.putExtra("FoodId",adapter.getRef(position).getKey());
startActivity(intent);

);


;

recyclerView.setAdapter(adapter);



error message :



11-14 13:19:34.636 8233-8233/com.pro.ijdev.proapp E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.pro.ijdev.proapp, PID: 8233
java.lang.RuntimeException: Unable to start activity ComponentInfocom.pro.ijdev.proapp/com.pro.ijdev.proapp.FoodList: java.lang.IllegalArgumentException: Can't call equalTo() and startAt() combined
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.IllegalArgumentException: Can't call equalTo() and startAt() combined
at com.google.firebase.database.Query.zze(Unknown Source:12)
at com.google.firebase.database.Query.equalTo(Unknown Source:0)
at com.pro.ijdev.proapp.FoodList.loadListFood(FoodList.java:63)
at com.pro.ijdev.proapp.FoodList.onCreate(FoodList.java:53)
at android.app.Activity.performCreate(Activity.java:7009)
at android.app.Activity.performCreate(Activity.java:7000)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856) 
at android.app.ActivityThread.-wrap11(Unknown Source:0) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:164) 
at android.app.ActivityThread.main(ActivityThread.java:6494) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 






android firebase firebase-realtime-database firebaseui






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 14 '18 at 11:21







ahmed asi

















asked Nov 14 '18 at 0:28









ahmed asiahmed asi

224




224







  • 1





    What is the current behaviour with the above code?

    – Dean coakley
    Nov 14 '18 at 0:34











  • @Deancoakley : Exception :D

    – ahmed asi
    Nov 14 '18 at 1:06






  • 1





    Can you attach your firebase structure. It's difficult to tell what's happening without that. And also, post what exception are you getting.

    – PradyumanDixit
    Nov 14 '18 at 3:53







  • 1





    @IbrahimHJabaly Keep in mind that Stack Overflow is an incredibly inefficient interactive debugger. If you get an exception, copy/paste the exact error message and stack trace into your question, so that we can see what you're getting.

    – Frank van Puffelen
    Nov 14 '18 at 4:34











  • Eng @FrankvanPuffelen : Done , I putted the error message .

    – ahmed asi
    Nov 14 '18 at 11:25












  • 1





    What is the current behaviour with the above code?

    – Dean coakley
    Nov 14 '18 at 0:34











  • @Deancoakley : Exception :D

    – ahmed asi
    Nov 14 '18 at 1:06






  • 1





    Can you attach your firebase structure. It's difficult to tell what's happening without that. And also, post what exception are you getting.

    – PradyumanDixit
    Nov 14 '18 at 3:53







  • 1





    @IbrahimHJabaly Keep in mind that Stack Overflow is an incredibly inefficient interactive debugger. If you get an exception, copy/paste the exact error message and stack trace into your question, so that we can see what you're getting.

    – Frank van Puffelen
    Nov 14 '18 at 4:34











  • Eng @FrankvanPuffelen : Done , I putted the error message .

    – ahmed asi
    Nov 14 '18 at 11:25







1




1





What is the current behaviour with the above code?

– Dean coakley
Nov 14 '18 at 0:34





What is the current behaviour with the above code?

– Dean coakley
Nov 14 '18 at 0:34













@Deancoakley : Exception :D

– ahmed asi
Nov 14 '18 at 1:06





@Deancoakley : Exception :D

– ahmed asi
Nov 14 '18 at 1:06




1




1





Can you attach your firebase structure. It's difficult to tell what's happening without that. And also, post what exception are you getting.

– PradyumanDixit
Nov 14 '18 at 3:53






Can you attach your firebase structure. It's difficult to tell what's happening without that. And also, post what exception are you getting.

– PradyumanDixit
Nov 14 '18 at 3:53





1




1





@IbrahimHJabaly Keep in mind that Stack Overflow is an incredibly inefficient interactive debugger. If you get an exception, copy/paste the exact error message and stack trace into your question, so that we can see what you're getting.

– Frank van Puffelen
Nov 14 '18 at 4:34





@IbrahimHJabaly Keep in mind that Stack Overflow is an incredibly inefficient interactive debugger. If you get an exception, copy/paste the exact error message and stack trace into your question, so that we can see what you're getting.

– Frank van Puffelen
Nov 14 '18 at 4:34













Eng @FrankvanPuffelen : Done , I putted the error message .

– ahmed asi
Nov 14 '18 at 11:25





Eng @FrankvanPuffelen : Done , I putted the error message .

– ahmed asi
Nov 14 '18 at 11:25












1 Answer
1






active

oldest

votes


















1














As the error says:




java.lang.IllegalArgumentException: Can't call equalTo() and startAt() combined




You cannot use both methods equalTo() and startAt() in a single call. If you want to sort your records according to multiple propeties, please take a look at my answer from this post, where I have explained how you can achieve this using a a combined property.






share|improve this answer























  • Hi Ibrahim! Have you tried my solution above?

    – Alex Mamo
    Nov 15 '18 at 7:43










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
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53291455%2fhow-can-i-display-the-category-between-example3-and-7-in-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









1














As the error says:




java.lang.IllegalArgumentException: Can't call equalTo() and startAt() combined




You cannot use both methods equalTo() and startAt() in a single call. If you want to sort your records according to multiple propeties, please take a look at my answer from this post, where I have explained how you can achieve this using a a combined property.






share|improve this answer























  • Hi Ibrahim! Have you tried my solution above?

    – Alex Mamo
    Nov 15 '18 at 7:43















1














As the error says:




java.lang.IllegalArgumentException: Can't call equalTo() and startAt() combined




You cannot use both methods equalTo() and startAt() in a single call. If you want to sort your records according to multiple propeties, please take a look at my answer from this post, where I have explained how you can achieve this using a a combined property.






share|improve this answer























  • Hi Ibrahim! Have you tried my solution above?

    – Alex Mamo
    Nov 15 '18 at 7:43













1












1








1







As the error says:




java.lang.IllegalArgumentException: Can't call equalTo() and startAt() combined




You cannot use both methods equalTo() and startAt() in a single call. If you want to sort your records according to multiple propeties, please take a look at my answer from this post, where I have explained how you can achieve this using a a combined property.






share|improve this answer













As the error says:




java.lang.IllegalArgumentException: Can't call equalTo() and startAt() combined




You cannot use both methods equalTo() and startAt() in a single call. If you want to sort your records according to multiple propeties, please take a look at my answer from this post, where I have explained how you can achieve this using a a combined property.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 14 '18 at 12:17









Alex MamoAlex Mamo

42.7k82860




42.7k82860












  • Hi Ibrahim! Have you tried my solution above?

    – Alex Mamo
    Nov 15 '18 at 7:43

















  • Hi Ibrahim! Have you tried my solution above?

    – Alex Mamo
    Nov 15 '18 at 7:43
















Hi Ibrahim! Have you tried my solution above?

– Alex Mamo
Nov 15 '18 at 7:43





Hi Ibrahim! Have you tried my solution above?

– Alex Mamo
Nov 15 '18 at 7:43

















draft saved

draft discarded
















































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.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53291455%2fhow-can-i-display-the-category-between-example3-and-7-in-firebase%23new-answer', 'question_page');

);

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







這個網誌中的熱門文章

Barbados

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3