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

  • SEARCH
  • Home
  • 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 8065089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:33:50+00:00 2026-06-05T11:33:50+00:00

Im gonna develope a Android app wich i have done few times before, but

  • 0

Im gonna develope a Android app wich i have done few times before, but the trick now is that i need to access a database (not sqllite in the device). And we have done a website before that has all the functions that i need. So my thought was to use that website (MVC3) to get information from the database, and send information to the database from the App.
Do you guys have some ideas for me how to code that? What i need is to recieve data from the website to the App with Json or Gson i guess, then i need to post up some data to the controllers from the App, dont know if i need to use url parameters or if i can use Jsom that way aswell?

  • 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-05T11:33:52+00:00Added an answer on June 5, 2026 at 11:33 am

    To send a json object in the ASP.NET Controller like:
    {“name”:”foo”,”age”:5}

    The code of the Controller could be something like:

    [HttpPost]
    public JsonResult MyAction(UserViewModel UserModel)
    {
        /* do something with your usermodel object */
        UserModel.Name = "foo";
        UserModel.Age = 5;
    
        return Json(UserModel, JsonRequestBehavior.AllowGet);
    }
    

    EDIT:
    On the Android side, here it is the method to send the request and receive the response:

    public void GetDataFromServer() {
    
       ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
       nameValuePairs.add(new BasicNameValuePair("data_1", "data"));
       nameValuePairs.add(new BasicNameValuePair("data_n", "data"));
       try { 
       HttpPost httppost = new HttpPost("http://path_to_the_controller_on_server");
       String result = RetrieveDataFromHttpRequest(httppost,nameValuePairs); 
       // parse json data
       JSONObject jObjRoot = new JSONObject(result); 
       String objName = jObjRoot.getString("Name"); 
           String objName = jObjRoot.getString("Age"); 
        } catch (JSONException e) {
       Log.e(TAG, "Error parsing data " + e.toString()); 
        }  
    }
    
    private String RetrieveDataFromHttpRequest(HttpPost httppost, ArrayList<NameValuePair> nameValuePairs ) {
    
        StringBuilder sb = new StringBuilder();
        try {
            HttpClient httpclient = new DefaultHttpClient();
            if (nameValuePairs != null)
                httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
            HttpResponse response = httpclient.execute(httppost);
            HttpEntity entity = response.getEntity();
            InputStream is = entity.getContent();
            // convert response to string
            BufferedReader reader = new BufferedReader(new InputStreamReader( is, "iso-8859-1"));
            String line = null;
            while ((line = reader.readLine()) != null) {
                sb.append(line + "\n");
            }
            is.close();
        } catch (UnsupportedEncodingException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IllegalStateException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return  sb.toString(); 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm gonna develope banner rotator porlet in Liferay, that will have preference view (Configuration
This may be rather noobish but I'm gonna ask anyhow. I have a class
Pretty soon now, we're gonna need to develop a GUI for creating configurations (more
I have a developed a application that is gonna to be used at multiple
Gonna need some advice for my work. In my computer I have installed VS2010
I know you are gonna hate me for that kind of question. But could
I know I'm gonna get down votes, but I have to make sure if
I'm gonna build presentation app, which will present a brand product. Presentation will have
I am gonna develop project in android 2.0,for that i ll be using images
I'm gonna create two div tags with CSS that appear in the page like

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.