SHOW:
|
|
- or go back to the newest paste.
| 1 | public static String postData(String title, String story_bhnd_idea, | |
| 2 | String idea_dtls, int spinnerBudgetId, int spinnerFounderIndexId, | |
| 3 | int spinnercategoryIndexId) {
| |
| 4 | ||
| 5 | final String url = "URL will be here"; | |
| 6 | ||
| 7 | - | JSONObject jsonPostIdea = new JSONObject(); |
| 7 | + | // Convert the string values into the JSON OBJECT with jsonPostIdea object |
| 8 | ||
| 9 | - | |
| 9 | + | |
| 10 | - | JSONObject JSONStoryBhndIdea = new JSONObject(); |
| 10 | + | |
| 11 | - | JSONArray jsonArrayStoryBhndIdea = new JSONArray(); |
| 11 | + | |
| 12 | - | try {
|
| 12 | + | |
| 13 | - | |
| 13 | + | |
| 14 | - | JSONStoryBhndIdea.put("value", story_bhnd_idea);
|
| 14 | + | |
| 15 | - | jsonArrayStoryBhndIdea.put(JSONStoryBhndIdea); |
| 15 | + | |
| 16 | - | |
| 16 | + | |
| 17 | - | System.out.println("=============> value of the Story Behind Idea:"+jsonArrayStoryBhndIdea.toString());
|
| 17 | + | |
| 18 | StringEntity se = new StringEntity( jsonPostIdea.toString()); | |
| 19 | - | } |
| 19 | + | |
| 20 | - | catch (Exception e) {
|
| 20 | + | |
| 21 | - | } |
| 21 | + | |
| 22 | - | |
| 22 | + | |
| 23 | - | |
| 23 | + | |
| 24 | - | |
| 24 | + | |
| 25 | - | JSONObject JSONIdeaDetails = new JSONObject(); |
| 25 | + | |
| 26 | - | JSONArray jsonArrayIdeaDetails = new JSONArray(); |
| 26 | + | |
| 27 | - | try {
|
| 27 | + | |
| 28 | - | |
| 28 | + | |
| 29 | - | JSONIdeaDetails.put("value", idea_dtls);
|
| 29 | + | |
| 30 | - | jsonArrayIdeaDetails.put(JSONIdeaDetails); |
| 30 | + | |
| 31 | - | |
| 31 | + | |
| 32 | - | System.out.println("=============> value of the Idea details:"+jsonArrayIdeaDetails.toString());
|
| 32 | + | |
| 33 | String streamValue = iStream_to_String(is); | |
| 34 | - | } |
| 34 | + | |
| 35 | - | catch (Exception e) {
|
| 35 | + | |
| 36 | ||
| 37 | - | |
| 37 | + | |
| 38 | - | |
| 38 | + | |
| 39 | - | |
| 39 | + | |
| 40 | - | JSONObject JSONBudget = new JSONObject(); |
| 40 | + | |
| 41 | - | JSONArray jsonArrayBudget = new JSONArray(); |
| 41 | + | |
| 42 | - | try {
|
| 42 | + | |
| 43 | - | |
| 43 | + | |
| 44 | - | JSONBudget.put("value", ""+spinnerBudgetId);
|
| 44 | + | |
| 45 | - | jsonArrayBudget.put(JSONBudget); |
| 45 | + | |
| 46 | - | |
| 46 | + | |
| 47 | - | System.out.println("=============> value of the Budget:"+jsonArrayBudget.toString());
|
| 47 | + | |
| 48 | ||
| 49 | - | } |
| 49 | + | |
| 50 | - | catch (Exception e) {
|
| 50 | + | |
| 51 | return streamValue; | |
| 52 | - | |
| 52 | + | |
| 53 | - | |
| 53 | + | |
| 54 | - | |
| 54 | + | |
| 55 | - | JSONObject JSONMyFounder = new JSONObject(); |
| 55 | + | |
| 56 | - | JSONArray jsonArrayMyFounder = new JSONArray(); |
| 56 | + | |
| 57 | - | try {
|
| 57 | + | |
| 58 | - | |
| 58 | + | |
| 59 | - | JSONMyFounder.put("nid", ""+spinnerFounderIndexId);
|
| 59 | + | |
| 60 | - | jsonArrayMyFounder.put(JSONMyFounder); |
| 60 | + | |
| 61 | - | |
| 61 | + | |
| 62 | - | System.out.println("=============> value of the My Founder:"+jsonArrayMyFounder);
|
| 62 | + | |
| 63 | ||
| 64 | - | } |
| 64 | + | |
| 65 | - | catch (Exception e) {
|
| 65 | + | |
| 66 | } | |
| 67 | ||
| 68 | - | |
| 68 | + | |
| 69 | - | |
| 69 | + | |
| 70 | - | JSONObject JSONCategory = new JSONObject(); |
| 70 | + | |
| 71 | - | |
| 71 | + | |
| 72 | - | try {
|
| 72 | + | |
| 73 | StringBuilder sb = new StringBuilder(); | |
| 74 | - | JSONObject Json = new JSONObject(); |
| 74 | + | |
| 75 | - | Json.put("tid", ""+spinnercategoryIndexId);
|
| 75 | + | |
| 76 | - | |
| 76 | + | |
| 77 | - | JSONCategory.put(""+spinnercategoryIndexId, Json);
|
| 77 | + | |
| 78 | - | |
| 78 | + | |
| 79 | - | System.out.println("=============> value of the category :"+JSONCategory);
|
| 79 | + | |
| 80 | - | |
| 80 | + | |
| 81 | - | } |
| 81 | + | |
| 82 | - | catch (Exception e) {
|
| 82 | + | |
| 83 | } | |
| 84 | - | |
| 84 | + | |
| 85 | - | /** |
| 85 | + | |
| 86 | - | * JSONObject For the post idea |
| 86 | + |