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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:00:51+00:00 2026-05-27T22:00:51+00:00

What I try to do I’m trying to create a Loginmask for my App.

  • 0

What I try to do


I’m trying to create a Loginmask for my App. To check if a userslogin is correct I create a HTTP-Post(JSON) to my server, from there I get response if the user is in the db-table or not.

For the moment the HTTP-POST dosn’t work, I allways get this Error:

12-26 14:02:22.871: W/System.err(869): java.lang.IllegalStateException: Target host must not be null, or set in parameters. scheme=null, host=null, path=api.i-v-o.ch

This seems really strange in my eyes because i defined the URL-Path.

Question


Like you saw, the problem is that i can’t etablish a Network Connection. Please tell me where the error is in my code, that I can fix it.

It would be also really great, if you could provide me a good tutorial for this, or a codesample, that I can fix the error on my own.

Thx for your help in Advance.

Down here you find the Code of my Activity and my DataHandler.

LoginActivity.class:

package de.ivocore;

import de.ivocore.service.DataHandler;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class LoginActivity extends Activity {

    public DataHandler JSONLogin = new DataHandler();


    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.login);

        //Text-Felder 
        final EditText user = (EditText) findViewById(R.id.edt_username);
        final EditText pwd = (EditText) findViewById(R.id.edt_password);

        //Button
        Button loginbt = (Button) findViewById(R.id.bt_login);



        //OnClickListner für den Button definieren
        loginbt.setOnClickListener(new View.OnClickListener(){

            public void onClick(View v){

                //Strings definieren
                final String usertxt = user.getText().toString();
                final String pwdtxt = pwd.getText().toString();

                if (usertxt != null && pwdtxt != null){
                JSONLogin.JSONLogin(usertxt, pwdtxt);
                }else{
                    Toast.makeText(LoginActivity.this, "Bitte Username und Passwort eingeben!", Toast.LENGTH_SHORT);
                }
            }
        });
    }
}

DataHandler.class

package de.ivocore.service;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;

import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicHeader;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.protocol.HTTP;
import org.json.JSONObject;

import android.os.Looper;
import android.util.Log;

public class DataHandler {

    /** LOGIN-Methode
     * Für diese Methode muss ein "final String username" sowie ein "final String password" mitgegeben werden
     * Die Methode fürt die Login-Prozedur mit dem api.i-v-o.ch durch.
     * Zurückgeben wird die Response welche vom Server kommt (Login erfolgreich oder nicht), sowie der Sessionkey.
     *  */
    public void JSONLogin(final String username, final String password){


        Thread t = new Thread(){                                                            //Neuen Thread definieren


            public void run(){                                                                  //Startet automatisch wenn der Thread gestartet wird, führt die Funktion aus


                String URL = "api.i-v-o.ch";                                                            //URL definieren für JSON-Post
                Looper.prepare();                                                                       //Erstellt den Nachrichten-Pool
                HttpClient client = new DefaultHttpClient();                                            //HttpClient definieren, handelt den http datenverkehr
                HttpConnectionParams.setConnectionTimeout(client.getParams(), 10000);                   //Timeout Limite
                HttpResponse response;                                                                  //HttpResponse definieren, handelt den http response
                JSONObject login = new JSONObject();                                                    //JSON-Object welches gesendet wird

                try{
                    HttpPost post = new HttpPost(URL);                                                  //HttpPost definieren, handelt den http post
                    login.put("username", username);                                                    //Füget dem JSONObject Login den Username ein
                    login.put("password", password);                                                    //Fügt dem JSONObject Login das Passwort ein

                    StringEntity se = new StringEntity("Login" + login.toString());                     //StringEntity definieren und StringEntity aus dem JSONObject Login erstellen
                    se.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
                    post.setEntity(se);                                                                 //Hier wird der Post an das IVO-Core gesendet
                    response = client.execute(post);                                                    //Hier wird die Response abgefangen


                    /** Response-Checker
                     * Hier wird gecheckt was wir in der Response bekommen
                     */
                    if(response != null){                                                               //Hier wird geprüft ob etwas in der Response ist

                        StringBuilder sb = new StringBuilder();                                         //Stringbuilder um aus dem Response einen String zu erstellen
                        BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));   //response vom inputstreamreader lesen und in einen bufferedreader einfügen um diesen anschliessend zu einem string hinzuzuzfügen und in ein json object umwandeln

                        String line;                                                                    //String definieren darin ist die später die response
                        while ((line = rd.readLine()) != null) {                                        //Hier wird definiert das der String Line den inhalt vom bufferedreader ist, der duchgand wird mit readLine durchgeführt
                            sb.append(line + "\n");                                                     //Hier wird der string line nach \n gesplittet (newline)
                            }

                        String result;                                                                  //String result definieren
                        result = sb.toString();                                                         //Hier wird der inhalt vom Stringbuilder zum String result hinzugefühgt
                        Log.d("DataHandler", "Append String " + result);                                //Gibt aus was im result drin ist


                    }

                } catch(Exception e){
                    e.printStackTrace();
                    Log.e("DataHandler", "Cannot Estabilish Connection");
                }
                Looper.loop();                                                                          //Nachrichten loopen
            }
        };
        t.start();                                                                                      //Thread starten
    }

}

Logcat:

12-26 14:00:29.331: W/System.err(869): java.lang.IllegalStateException: Target host must not be null, or set in parameters. scheme=null, host=null, path=api.i-v-o.ch
12-26 14:00:29.331: W/System.err(869):  at org.apache.http.impl.client.DefaultRequestDirector.determineRoute(DefaultRequestDirector.java:591)
12-26 14:00:29.331: W/System.err(869):  at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:293)
12-26 14:00:29.331: W/System.err(869):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
12-26 14:00:29.331: W/System.err(869):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
12-26 14:00:29.331: W/System.err(869):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
12-26 14:00:29.341: W/System.err(869):  at de.ivocore.service.DataHandler$1.run(DataHandler.java:51)
12-26 14:00:29.341: E/DataHandler(869): Cannot Estabilish Connection
12-26 14:02:22.871: W/System.err(869): java.lang.IllegalStateException: Target host must not be null, or set in parameters. scheme=null, host=null, path=api.i-v-o.ch
12-26 15:09:44.431: W/System.err(936): java.net.UnknownHostException: Unable to resolve host "api.i-v-o.ch": No address associated with hostname
12-26 15:09:44.441: W/System.err(936):  at java.net.InetAddress.lookupHostByName(InetAddress.java:426)
12-26 15:09:44.441: W/System.err(936):  at java.net.InetAddress.getAllByNameImpl(InetAddress.java:242)
12-26 15:09:44.441: W/System.err(936):  at java.net.InetAddress.getAllByName(InetAddress.java:220)
12-26 15:09:44.441: W/System.err(936):  at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:137)
12-26 15:09:44.441: W/System.err(936):  at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
12-26 15:09:44.451: W/System.err(936):  at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
12-26 15:09:44.451: W/System.err(936):  at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)
12-26 15:09:44.451: W/System.err(936):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
12-26 15:09:44.481: W/System.err(936):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
12-26 15:09:44.501: W/System.err(936):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
12-26 15:09:44.501: W/System.err(936):  at de.ivocore.service.DataHandler$1.run(DataHandler.java:51)
12-26 15:09:44.501: W/System.err(936): Caused by: libcore.io.GaiException: getaddrinfo failed: EAI_NODATA (No address associated with hostname)
12-26 15:09:44.511: W/System.err(936):  at libcore.io.Posix.getaddrinfo(Native Method)
12-26 15:09:44.511: W/System.err(936):  at libcore.io.ForwardingOs.getaddrinfo(ForwardingOs.java:55)
12-26 15:09:44.511: W/System.err(936):  at java.net.InetAddress.lookupHostByName(InetAddress.java:411)
12-26 15:09:44.511: W/System.err(936):  ... 10 more
12-26 15:09:44.511: E/DataHandler(936): Cannot Estabilish Connection
  • 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-05-27T22:00:52+00:00Added an answer on May 27, 2026 at 10:00 pm

    Add “http://” to "api.i-v-o.ch"

    So it should be: “http://api.i-v-o.ch”

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

Sidebar

Related Questions

Try: http://maps.googleapis.com/maps/api/geocode/json?address =Őrbottyán,Hungary&sensor=true On an iPhone 4 & simulator, -(void)requestFailed:(ASIHTTPRequest *)request { NSLog(@geocode fail
try { PreparedStatement s = (PreparedStatement) conn.prepareStatement(SELECT voters.Check,count(*) FROM voting.voters where FirstName=+first+and LastName=+last+ and
try: spam.foo except AttributeError: do_somthing() (Is it wise to check an attribute like that
try { $dbh = new PDO('mysql:host=localhost;dbname=wqposts', 'root', ''); $query = SELECT wqpid FROM threads
try{ String query= select user_name from user; ResultSet rs = queries.performQuery(query); while(rs.next()){ System.out.println(User Name
Try the URL in a browser below, it streams fine. Why is there an
try { // Create an appending file handler boolean append = true; FileHandler handler
Try executing this SQL: select OWNER,TABLE_NAME,COLUMN_NAME,DATA_TYPE, DATA_LENGTH,DATA_PRECISION,DATA_SCALE,NULLABLE from all_tab_columns where owner = 'USER'; You
Try this URL: http://sharepoint.iceweb.com/sites/demo/default.aspx?wsdl (user: demo@icemail.com, pass: demo) As far as I remember this
Try to publish a web forms asp.net application on iis6 running on win2k server.

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.