GeeCON Prague 2014*
The moose likes Android and the fly likes Import Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Mobile » Android
Bookmark "Import Problem" Watch "Import Problem" New topic
Author

Import Problem

prazannag Kumar
Greenhorn

Joined: Feb 25, 2010
Posts: 12
Hi,

I need to include the following header files but these are can't resolved.

import android.net.http.EventHandler;
import android.net.http.Headers;
import android.net.http.RequestQueue;

I got the Error Message:
"The import android.net.http.RequestQueue cannot be resolved"

Can anyone please tell me, how to fix this issue.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42046
    
  64
The Android API does not have any of these classes, in any package, as can be easily verified by looking at the API docs. What makes you think that they exist?


Ping & DNS - my free Android networking tools app
prazannag Kumar
Greenhorn

Joined: Feb 25, 2010
Posts: 12
I need to connect the android application with PHP page. So these classes are needed to perform. I found the android.net.http does not contain any of the classes i mentioned before. Let me know how to fix it..
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42046
    
  64
Did you actually read -and think about- what I wrote? What is the answer to the question I asked?
prazannag Kumar
Greenhorn

Joined: Feb 25, 2010
Posts: 12
Yes I got it now. I just confused by refer some sample codes. So we have to write those classes. Thanks a lot. Also i have one more doubt in ksoap2. I tried to connect the android application to PHP. But it seems no response. Let me know what I did wrong...
---------
package com.org.WebTest;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class WebTest extends Activity {
/** Called when the activity is first created. */

private static final String SOAP_ACTION = "HelloYou";
private static final String METHOD_NAME = "getHello";
private static final String NAMESPACE = "urn:HelloYou";
private static final String URL = "http://115.240.187.197/mypro/services.php";



private Object resultsRequestSOAP = null;

@Override
public void onCreate(Bundle icicle)
{
super.onCreate(icicle);
TextView tv = new TextView(this);
setContentView(R.layout.main);
// final TextView ot=(TextView)findViewById(R.id.tvv);

SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);


//SoapObject
request.addProperty("firstname", "prasanna");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);


HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try
{
androidHttpTransport.call(SOAP_ACTION, envelope);
resultsRequestSOAP = envelope.getResponse();
String[] results = (String[]) resultsRequestSOAP;
tv.setText( results[0].toString());


}
catch (Exception aE)
{
aE.printStackTrace ();
tv.setText(aE.toString());
}
}
-----
my PHP code is :

<?php
echo "prasanna";
?>
-------
 
GeeCON Prague 2014
 
subject: Import Problem