Comments (12)
Anyone can help me, please?
from fatsecret4j.
@ariefpurnamamuharram Recipe has Serving object in it from which you can get all the details. Also Food has an array of Service objects which give details about all kinds of different servings.
May I know which Recipe/Food are you trying to retrieve?
from fatsecret4j.
No, it is not about recipe.
Let me assume Indomie. I want to get the serving details of Indomie, just like Calories, Natrium, etc. How to do that? Can you give me an example code?
Thank you @ranesr
from fatsecret4j.
In that case, you are looking for Food.
You can use this code:
String key = "ENTER YOUR KEY HERE";
String secret = "ENTER YOUR SECRET HERE";
FatsecretService service = new FatsecretService(key, secret);
String query = "Indomie";
Response<CompactFood> response = service.searchFoods(query);
List<CompactFood> results = response.getResults();
for (CompactFood food: results) {
Food f = service.getFood(food.getId());
if (f.getServings() != null && f.getServings().size() > 0) {
// The following line will give you Serving object.
Serving serving = f.getServings().get(0);
System.out.println("servingDescription: " + serving.getServingDescription());
System.out.println("servingUrl: " + serving.getServingUrl());
System.out.println("calories: " + serving.getCalories());
}
}
You can find more about Serving object here. There is a lot of information you will get from this object, like calories, carbohydrates, proteins, etc.
from fatsecret4j.
I try to implement the code, but I encountered some errors. What should I do? @ranesr
Thank you.
from fatsecret4j.
@ranesr can you help me by giving me the full codes of the example?
Thank you
from fatsecret4j.
@ariefpurnamamuharram Have you added this to your build.gradle
file?
from fatsecret4j.
Yes, I have. But it doesn't resolve my problem. @ranesr
from fatsecret4j.
Any solution for my problem, please? @ranesr
Thank you
from fatsecret4j.
@ariefpurnamamuharram Can you share your FoodSearchActivity.java
file?
from fatsecret4j.
@ranesr
I just copy the code that you have give it to me.
from fatsecret4j.
@ranesr @ohdihe could anyone please help me?
thank you
from fatsecret4j.
Related Issues (18)
- How to get user Authenticated and get the request token and OAuth token
- There is no exercise entity...
- Please help me get a response HOT 3
- getFoods and getRecipes failing when only 1 result returned HOT 1
- brand_name not parsed HOT 2
- some recipe is not loading? HOT 1
- getRecipe not working in android as it should!
- Help to get in-app products from Russia
- Using this library on Android HOT 1
- create a food
- requests should be https HOT 2
- To make the code work for Android Version < 24 HOT 3
- Food are not showing when integrating with java using maven HOT 2
- Please provide information how to use this api step by step. HOT 1
- Help! Error on implementing the example
- Sometimes this method gives the Required result, But sometimes it gives either calorie null or Whole list Blank.
- How to use FatSecret4J for getting food calorie data HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fatsecret4j.