Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9154551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:26:45+00:00 2026-06-17T12:26:45+00:00

In my application i have to integrate API. I am not getting code for

  • 0

In my application i have to integrate API. I am not getting code for how to check whether internet is available or not. How to send JSON Data to server. Please help me out. As in android we call API in AsyncTask class. In blackberry i did not found like this.

Suggest me some link or ideas so that i can integrate code. I am googling. But did not getting result .
What I have tried is here:

 JSONObject postData = new JSONObject();
 postData.put("userId", "24");
 postData.put("messageTime","06:00:00");
 postData.put("language", language[lang_Ocf.getSelectedIndex()]);
 System.out.println("********json********"+postData);

 ConnectionFactory conFactory = new ConnectionFactory();
 ConnectionDescriptor conDesc = null;
 try
 {
    conDesc = conFactory.getConnection(url+";deviceside=true");
 }
 catch(Exception e)
 {
    System.out.println(e.toString()+":"+e.getMessage());
 }

 String response = ""; // this variable used for the server response
 // if we can get the connection descriptor from ConnectionFactory
 if(null != conDesc)
 {
    try
    {
       HttpConnection connection = (HttpConnection)conDesc.getConnection();
       //set the header property
       connection.setRequestMethod(HttpConnection.POST);
       connection.setRequestProperty("Content-Length", Integer.toString(postData.length())); 
       connection.setRequestProperty("Content-Type","application/json");
       OutputStream out = connection.openOutputStream();
       out.write(postData.get);
       out.flush();
       out.close();
       int responseCode = connection.getResponseCode(); 
       if(responseCode == HttpConnection.HTTP_OK){

          InputStream in = connection.openInputStream();
          StringBuffer buf = new StringBuffer();
          int read = -1;
          while((read = in.read())!= -1)
             buf.append((char)read);

          response = buf.toString();
       }
       Dialog.inform(response);

       connection.close();
    } catch(Exception e) {

    }
 }

 return response;

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T12:26:45+00:00Added an answer on June 17, 2026 at 12:26 pm

    I solved this problem

    Error:

    Error: Cannot run program “jar”: CreateProcess error=2, The system cannot find the file specified Packaging project HelaBibleWhereUR failed (took 10.715 seconds)

    I simply put jar.exe that is under java bin folder in the jre bin folder.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have integrate Foursquare API for iPhone application.I want to check this particular user
I have integrate draw line in my application i have not used OpenGL or
I want to integrate the zxing source code to my Android application. I have
I am not getting any response by Google Checkout: I have the sample code
I have created an iPhone application. I want to integrate SoundCloud API with my
I have integrate twitter api in my application. In my application i have got
I have to integrate PDF file in my iPad Application. So now, is it
I have a JSP struts application that uses Spring to integrate with the services/dao/database.
We have an asp.net mvc application that we would like to integrate a FileSystemWatcher
I have a php application , and I'm trying to integrate with paypal payment

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.