I am newbie in Calenderview android. May be this question is duplicate but I had been tried lots of question from last three days but I am unable to make a circle on specific dates and dates will come from volley response.
I really do not know how to make this because I am able get volley response but unable to set in calendar and make a circle on that.
Here is my json response.
{
"status": "200",
"msg": "Successfully",
"response": [
{
"date": "2019-03-02",
"status": "1"
},
{
"date": "2019-03-04",
"status": "1"
},
{
"date": "2019-03-05",
"status": "1"
},
{
"date": "2019-03-06",
"status": "1"
},
{
"date": "2019-02-28",
"status": "1"
},
{
"date": "2019-02-27",
"status": "1"
},
{
"date": "2019-02-25",
"status": "1"
},
{
"date": "2019-02-21",
"status": "1"
}
]
}
Related
I am a newbie to android. I am stuck at JSON parsing.
Following is my JSON, in this, the type of menu categories will be dynamic, and I want to arrange this JSON in sectioned recycler view.
Please help me out.
This is my JSON
{
"menu_items": {
"Plat": [{
"menu_name": "jambon à l'os",
"menu_cost": "18.00",
"menu_count": "1",
"category": "Plat",
"menu_tax": "5.50",
"code": "€"
},
{
"menu_name": "tacos",
"menu_cost": "6.00",
"menu_count": "1",
"category": "Plat",
"menu_tax": "5.50",
"code": "€"
}
],
"Entrée": [{
"menu_name": "avocat",
"menu_cost": "7.50",
"menu_count": "1",
"category": "Entrée",
"menu_tax": "5.50",
"code": "€"
}]
},
"order_data": {
"order_id": "278",
"order_number": "REF-5d5e6b86",
"created_at": "1566468998",
"instructions": "",
"fullname": "Rohan Chitnis",
"phonenumber": "7610771871",
"useraddress": "Brest, France",
"image_path": "https://restau-at-home.bzh/uploads/attachments/Jellyfish_2019_08_21_10_49_21.jpg",
"wp": "pune",
"code": "€",
"promocode": null,
"promo_value": null,
"promo_type": null
},
"order_details": {
"total_items": "3",
"order_total": "31.50"
},
"promo_applied": "0",
"error": {
"code": "13",
"status": "200",
"message": "Ok"
}
}
Check this out. Create a generic response class. Extend your classes from that class. To do this properly you can look at Java Generics and Inheritance topics if you are using Java. And then search about Sectioned RecyclerView in Android. Here is a library for this.
I want to store objects received from API call into realm db.
Sample Obj:
[
{
"obj_type": "ClassSession",
"_id": "0341bd22-1182-4db3-a667-c8647012741e",
"version": "b2",
"createdOn": "2017-04-01 12:57:39 +0530",
"stage": "SCHEDULED",
"type": "Class Session",
"scheduled_at": "2017-04-01 12:58:39 +0530"
},
{
"obj_type": "Assignment",
"_id": "CmsRsrc2",
"version": "b3",
"name": "Homework",
"type": "HOMEWORK",
"parent": {
"type": "topic",
"id": "parent_id1"
},
"resource_id": "CmsRsrc2",
"assignmentProperty": {}
},
{
"obj_type": "Task",
"_id": "21b72bc0eb3e6d4a1c2bb332593ee19bbc527c92c9249585bed785fc6339e155",
"version": "b0",
"source": {
"type": "T_PROBLEM",
"id": "problem_id1_1"
},
"correctAnswer": 1
},
{
"obj_type": "TaskRecord",
"_id": "ff0748aea74431786a20629ad57676fc84eaa7396b153206540ee9eac1d9bfc8",
"assignmentId": "CmsRsrc2",
"version": "b0/",
"status": "ACTIVE",
"marking_scheme": {},
"sequence": 1
}
]
I have realm class for each obj_type but I don't know how to receive the obj from api as the response obj received from api does not belong to any realm class.
So I am looking for a way to receive the obj sent by api and save it to corresponding realm class.
I have this json
{
"results": [{
"gender": "male",
"name": {
"title": "mr",
"first": "isidro",
"last": "nogueira"
},
"location": {
"street": "3663 rua amazonas ",
"city": "mesquita",
"state": "rio de janeiro",
"postcode": 27744
},
"email": "isidro.nogueira#example.com",
"login": {
"username": "orangegoose315",
"password": "redalert",
"salt": "Dd3U7U03",
"md5": "325f1e8753222facba6ee63a5e2451de",
"sha1": "a63a0c544a956e235330b0ed76d11d3ad17c7979",
"sha256": "ddf18ffff89684617b2c7b8c5c175b9570cb6005916d9b4f3face802bd4f13a1"
},
"dob": "1967-04-23 04:58:32",
"registered": "2016-05-08 01:56:44",
"phone": "(11) 8368-8583",
"cell": "(17) 9743-3074",
"id": {
"name": "",
"value": null
},
"picture": {
"large": "https://randomuser.me/api/portraits/men/57.jpg",
"medium": "https://randomuser.me/api/portraits/med/men/57.jpg",
"thumbnail": "https://randomuser.me/api/portraits/thumb/men/57.jpg"
},
"nat": "BR"
}],
"info": {
"seed": "5b3dff5c25caaf7f",
"results": 1,
"page": 1,
"version": "1.1"
}
}
This data is of just one user. I have 50 of them.
I am still in learning stage and what I have done is that I have successfully listed all user in an activity. Now what I want to do is when I click on a user it should show it's related details in next activity...
List Users->Select Users->Show selected user details
I still don't know how to send data to other activity and display it.
I am parsing json object from facebook.
In my facebook json object, there are string keys inside key array "data".
My Code as follows,
"data": [
{
"id": "100001211447563_300696056647440",
"from": {
"name": "Seho Lee",
"id": "100001211447563"
},
"story": "Seho Lee is now using Facebook in English (US).",
"story_tags": {
"0": [
{
"id": 100001211447563,
"name": "Seho Lee",
"offset": 0,
"length": 8
}
]
},
"type": "status",
"created_time": "2012-01-19T09:13:04+0000",
"updated_time": "2012-01-19T09:13:04+0000",
"comments": {
"count": 0
}
},
{
"id": "100001211447563_298802933503419",
"from": {
"name": "Seho Lee",
"id": "100001211447563"
},
"story": "Seho Lee started using Graph API Explorer.",
"story_tags": {
"23": [
{
"id": 145634995501895,
"name": "Graph API Explorer",
"offset": 23,
"length": 18
}
],
"0": [
{
"id": 100001211447563,
"name": "Seho Lee",
"offset": 0,
"length": 8
}
]
},
"picture": "http://photos-a.ak.fbcdn.net/photos-ak-snc1/v43/11/145634995501895/app_1_145634995501895_4870.gif",
"link": "http://developers.facebook.com/tools/explorer/",
"caption": "A tool to help you browse objects within the Facebook Graph API, manage permissions, obtain access tokens and generally learn how it all works.",
"actions": [
{
"name": "Comment",
"link": "http://www.facebook.com/100001211447563/posts/298802933503419"
},
{
"name": "Like",
"link": "http://www.facebook.com/100001211447563/posts/298802933503419"
}
],
"type": "link",
"created_time": "2012-01-16T09:47:57+0000",
"updated_time": "2012-01-16T09:47:57+0000",
"comments": {
"count": 0
}
},
{
"id": "100001211447563_298789650171414",
"from": {
"name": "Seho Lee",
"id": "100001211447563"
},
"story": "Seho Lee likes myFBCovers.com.",
"story_tags": {
"15": [
{
"id": 160901873998019,
"name": "myFBCovers.com",
"offset": 15,
"length": 14
}
],
"0": [
{
"id": 100001211447563,
"name": "Seho Lee",
"offset": 0,
"length": 8
}
]
},
"type": "status",
"created_time": "2012-01-16T08:57:33+0000",
"updated_time": "2012-01-16T08:57:33+0000",
"comments": {
"count": 0
}
}
when I parsing this json object, String key "likes" is sometimes exist and sometimes do not exist in "data" jsonArray. So when I parsing JsonString "likes", sometimes I gets JSONException since I am parsing null value. Is there any way to skipping "null" json value?
Please help me regarding this.
if try catch it, next processes will be skipped.
you can check by isNull("name") method.
Edit: this is to check key. since you mentioned key exists sometimes. did you mean the value?
use JSONObjects method has(key)
data = (JSONObject) new JSONTokener(jsonObjRecv.toString()).nextValue();
if data.has("like"){
...
}
to check whether the value is null check with isNull("name")
I have a problem getting my feeds.
1- I (emiliano nunez) post a photo with my cellphone (android) and add (With) "hall 9000".
I (hall 9000) get feeds by graph api:
https://graph.facebook.com/me/feed?access_token=..........
{
"from": {
"name": "Emiliano Gustavo Nu\u00f1ez",
"id": "100001535156886"
},
"type": "photo",
"picture": "http://photos-a.ak.fbcdn.net/hphotos-ak-snc7/386161_265139050213931_100001535156886_723669_443588989_s.jpg",
"message": "Ibrick test",
"with_tags": {
"data": [
{
"name": "Hal Nuevemil",
"id": "100003200111123"
}
]
},
"to": {
"data": [
{
"name": "Hal Nuevemil",
"id": "100003200111123"
}
]
},
"id": "100001535156886_265139076880595",
"created_time": "2011-12-29T18:43:49+0000"
}
I can see "with_tags" section with hall 9000 :)
Until now perfect..
2 - then i repeat the procedure with other photo ... and get:
{
"from": {
"name": "Emiliano Gustavo Nu\u00f1ez",
"id": "100001535156886"
},
"type": "photo",
"picture": "http://photos-e.ak.fbcdn.net/hphotos-ak-snc7/396071_265171810210655_100001535156886_723868_1962904772_s.jpg",
"id": "100001535156886_265171840210652",
"created_time": "2011-12-29T19:44:56+0000"
},
I don't see "with_tags" section.
:(
For more details:
http://i.stack.imgur.com/N4knz.png
http://i.stack.imgur.com/uPqvh.png