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 8448261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:22:45+00:00 2026-06-10T10:22:45+00:00

I know this has been asked before but I’m struggling.. I barely know any

  • 0

I know this has been asked before but I’m struggling.. I barely know any Java, but want an app so I can do my POST request without opening my website.

So I’ve got this layout

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <EditText
        android:id="@+id/editText1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:ems="10"
        android:inputType="textPersonName" />

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:text="Name:"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:textSize="20dp" />

    <EditText
        android:id="@+id/editText2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/editText1"
        android:layout_below="@+id/editText1"
        android:ems="10"
        android:inputType="textPostalAddress" />

    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignTop="@+id/editText2"
        android:text="Address:"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:textSize="20dp" />

    <EditText
        android:id="@+id/editText3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/editText2"
        android:ems="10"
        android:inputType="phone" />

    <TextView
        android:id="@+id/textView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/editText2"
        android:text="Phone:"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:textSize="20dp" />

    <EditText
        android:id="@+id/editText4"
        android:layout_width="wrap_content"
        android:layout_height="200dp"
        android:layout_alignLeft="@+id/editText3"
        android:layout_below="@+id/editText3"
        android:ems="10"
        android:inputType="textMultiLine" />

    <TextView
        android:id="@+id/textView4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignTop="@+id/editText4"
        android:text="Comments:"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:textSize="15dp" />

    <Button
        android:id="@+id/button1"
        android:layout_width="300dp"
        android:layout_height="50dp"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/editText4"
        android:layout_toLeftOf="@+id/editText4"
        android:text="Done"
        android:onClick="goToWeb(???);" />

</RelativeLayout>

and this Java:

package com.example.request;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;

public class MainRequest extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_request);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main_request, menu);
        return true;
    }

    public void goToWeb() {
        /* open webpage - how? */
    }
}

I want to make this POST request to http://www.example.com when they click Done:

name: (content of @+id/editText1)
addr: (content of @+id/editText2)
phone: (content of @+id/editText3)
comment: (content of @+id/editText4)

I want the phone’s browser to open, and perform the POST request (if that makes sense)

How do I do this?

  • 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-10T10:22:46+00:00Added an answer on June 10, 2026 at 10:22 am

    Try this Class MainRequest

    package com.example.teststack;
    
    import java.util.ArrayList;
    import java.util.List;
    
    import org.apache.http.HttpResponse;
    import org.apache.http.NameValuePair;
    import org.apache.http.client.entity.UrlEncodedFormEntity;
    import org.apache.http.client.methods.HttpPost;
    import org.apache.http.impl.client.DefaultHttpClient;
    import org.apache.http.message.BasicNameValuePair;
    import org.apache.http.protocol.HTTP;
    import org.apache.http.util.EntityUtils;
    
    import android.app.Activity;
    import android.content.Intent;
    import android.os.Bundle;
    import android.view.Menu;
    import android.view.View;
    import android.view.View.OnClickListener;
    import android.webkit.WebView;
    import android.widget.Button;
    import android.widget.EditText;
    
    public class MainRequest extends Activity {
    
        EditText textPersonName = null;
        EditText textPostalAddress = null;
        EditText phone = null;
        EditText textMultiLine = null;
        Button submit = null;
        String action = "http://www.omokoroacomputerhelp.com/";
        HttpPost httpRequest = null;
        List<NameValuePair> params = null;
        HttpResponse httpResponse = null;
        WebView webView = null;
    
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main_request);
            textPersonName = (EditText) findViewById(R.id.personName);
            textPostalAddress = (EditText) findViewById(R.id.postalAddress);
            phone = (EditText) findViewById(R.id.phone);
            textMultiLine = (EditText) findViewById(R.id.multiLine);
            submit = (Button) findViewById(R.id.submit);
            submit.setOnClickListener(new OnClickListener() {
    
                @Override
                public void onClick(View v) {
                    httpRequest = new HttpPost(action);
                    params = new ArrayList<NameValuePair>();
                    params.add(new BasicNameValuePair("name", textPersonName
                            .getText().toString()));
                    params.add(new BasicNameValuePair("phone", phone.getText()
                            .toString()));
                    params.add(new BasicNameValuePair("addr", textPostalAddress
                            .getText().toString()));
                    params.add(new BasicNameValuePair("comment", textMultiLine
                            .getText().toString()));
                    try {
                        // send http request
                        httpRequest.setEntity(new UrlEncodedFormEntity(params,
                                HTTP.UTF_8));
                        // get http response
                        httpResponse = new DefaultHttpClient().execute(httpRequest);
                        //
                        Intent gotoIntent = new Intent(MainRequest.this,
                                Webpage.class);
                        gotoIntent.putExtra("source",
                                EntityUtils.toString(httpResponse.getEntity()));
                        startActivity(gotoIntent);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            });
        }
    
        @Override
        public boolean onCreateOptionsMenu(Menu menu) {
            getMenuInflater().inflate(R.menu.activity_main_request, menu);
            return true;
        }
    
    }
    

    and Webpage

    package com.example.teststack;
    
    import android.app.Activity;
    import android.content.Intent;
    import android.os.Bundle;
    import android.view.Menu;
    import android.webkit.WebView;
    
    public class Webpage extends Activity {
        WebView webView;
    
        final String mimeType = "text/html";
    
        final String encoding = "utf-8";
    
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_webpage);
            Intent webPageIntent = getIntent();
            String htmlSource = webPageIntent.getStringExtra("source");
            webView = (WebView) findViewById(R.id.webview);
            webView.loadData(htmlSource, mimeType, encoding);
        }
    
        @Override
        public boolean onCreateOptionsMenu(Menu menu) {
            getMenuInflater().inflate(R.menu.activity_webpage, menu);
            return true;
        }
    }
    

    and activity_main_request.xml

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
    
        <EditText
            android:id="@+id/personName"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:ems="10"
            android:inputType="textPersonName" />
    
        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true"
            android:text="Name:"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textSize="20dp" />
    
        <EditText
            android:id="@+id/postalAddress"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/personName"
            android:layout_below="@+id/personName"
            android:ems="10"
            android:inputType="textPostalAddress" />
    
        <TextView
            android:id="@+id/textView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignTop="@+id/postalAddress"
            android:text="Address:"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textSize="20dp" />
    
        <EditText
            android:id="@+id/phone"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_below="@+id/postalAddress"
            android:ems="10"
            android:inputType="phone" />
    
        <TextView
            android:id="@+id/textView3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_below="@+id/postalAddress"
            android:text="Phone:"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textSize="20dp" />
    
        <EditText
            android:id="@+id/multiLine"
            android:layout_width="wrap_content"
            android:layout_height="200dp"
            android:layout_alignLeft="@+id/phone"
            android:layout_below="@+id/phone"
            android:ems="10"
            android:inputType="textMultiLine" />
    
        <TextView
            android:id="@+id/textView4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignTop="@+id/multiLine"
            android:text="Comments:"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textSize="15dp" />
    
        <Button
            android:id="@+id/submit"
            android:layout_width="300dp"
            android:layout_height="50dp"
            android:layout_alignParentLeft="true"
            android:layout_below="@+id/multiLine"
            android:layout_toLeftOf="@+id/multiLine"
            android:text="Done" />
    
    </RelativeLayout>
    

    and activity_webpage.xml

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
    
       <WebView  
            android:id="@+id/webview"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            />
    
    </RelativeLayout>
    

    and AndroidManifest.xml

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.example.teststack"
        android:versionCode="1"
        android:versionName="1.0" >
    
        <uses-sdk
            android:minSdkVersion="8"
            android:targetSdkVersion="15" />
    
        <uses-permission android:name="android.permission.INTERNET" />
    
        <application
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name"
            android:theme="@style/AppTheme" >
            <activity
                android:name=".MainRequest"
                android:label="@string/title_activity_main" >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
    
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
            <activity
                android:name=".Webpage"
                android:label="@string/title_activity_webpage" >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
    
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
        </application>
    
    </manifest>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Yes, I know this question has been asked before, but I can't find an
I know this has probably been asked before, but I can't find it with
I know this question has been asked before, but no one has given any
I know this has probably been asked before but I can't find a specific
I know this has been asked before, but for my circumstance, I can't seem
I know this has been asked before, but I just can't seem to get
I know this has probably been asked before but I can't seem to find
I know this question has been asked before, but I tried eveything and can't
I know this has been asked before, but i can't find a good answer
I know this has been asked before but I can't find it so... Say

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.