Need Web service sample code for me(Beginner)

by veeramanikanda...@gmail.com » Tue, 25 May 2010 01:59:39 GMT


Sponsored Links
 Dear Android Developers,

Actually I'm a beginner for android applications.. Really I am
struggling in developing web service development in android....

please help me...


Thank You in advance..


--



Other Threads

1. Service works on 1.1, not on 1.5

Our remote service is working great on 1.1. It is a pretty rich API too.

BUT, running the same code on cupcake, it hangs after the service 
returns the concrete interface stub it has new'd in onBind(). 
(onConnect() in the client's ServiceConnection is never executed.)

Any thoughts?

Thanks

-- Ward

--~--~---------~--~----~------------~-------~--~----~

2. JNI Running

Ok I have been trying and trying to get a simple JNI program running.

This is my source:
Run.java:

package corey.nativetest;

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

public class Run extends Activity {

    private native int print();

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

    @Override
    protected void onStart() {
        // TODO Auto-generated method stub
        super.onStart();
        ((TextView)findViewById(R.id.text)).setText(print());
    }
    static {
        try {
            Log.i("JNI", "Trying to load libRun.so");
            System.loadLibrary("/data/lib/libRun.so");
        }
        catch (UnsatisfiedLinkError ule) {
            Log.e("JNI", "WARNING: Could not load libRun.so");
        }
    }
}

Run.c:
#include <jni.h>
#include <stdio.h>
#include "Run.h"


JNIEXPORT jint JNICALL Java_Run_print(JNIEnv * x, jobject y)
{
    return (jint)42;
}

static JNINativeMethod sMethods[] = {
     /* name, signature, funcPtr */
    {"print", "()I", (void*)Java_Run_print}
};


jint JNI_OnLoad(JavaVM* vm, void* reserved)
{
    static const char* const kClassName = "corey/nativetest/Run";
    JNIEnv* env;
    if ((*vm)->GetEnv(vm, (void**) &env, JNI_VERSION_1_4) != JNI_OK)
        return -1;

    /* get class with (*env)->FindClass */
    /* register methods with (*env)->RegisterNatives */

    jclass clazz;

    /* look up the class */
    clazz = (*env)->FindClass(env, kClassName);
    if (clazz == NULL) {
        return -1;
    }

    (*env)->RegisterNatives(env, clazz, sMethods, 1);

    return JNI_VERSION_1_4;
}

int main(int argc, char **argv) {
    return 0;
}

and my .h is really just the "javah -jni" prebuilt one.

I compiled it using the instructions here:
 http://www.***.com/ 
 http://www.***.com/ 

adb push libRun.so /data/lib/


Nothing works, I get

I/jdwp    (  942): received file descriptor 20 from ADB
I/dalvikvm(  942): De{*filter*} thread not active, ignoring DDM send
(t=0x54455354 l
=8)
W/SurfaceFlinger(  582): executeScheduledBroadcasts() skipped, contention on
the
 client. We'll try again later...
D/dalvikvm(  553): GC freed 227 objects / 8600 bytes in 224ms
D/dalvikvm(  553): GC freed 7 objects / 272 bytes in 163ms
D/dalvikvm(  553): GC freed 2 objects / 56 bytes in 130ms
I/JNI     (  942): Trying to load libRun.so
E/JNI     (  942): WARNING: Could not load libRun.so
D/dalvikvm(  942): +++ not scanning '/system/lib/libwebcore.so' for 'print'
(wrong CL)
D/dalvikvm(  942): +++ not scanning '/system/lib/libmedia_jni.so' for
'print' (wrong CL)
W/dalvikvm(  942): No implementation found for native
Lcorey/nativetest/Run;.print ()I
D/AndroidRuntime(  942): Shutting down VM
W/dalvikvm(  942): threadid=3: thread exiting with uncaught exception
(group=0x4000fe70)
E/AndroidRuntime(  942): Uncaught handler: thread main exiting due to
uncaught exception
E/AndroidRuntime(  942): java.lang.UnsatisfiedLinkError: print
E/AndroidRuntime(  942):        at corey.nativetest.Run.print(Native Method)
E/AndroidRuntime(  942):        at corey.nativetest.Run.onStart(Run.java:23)
E/AndroidRuntime(  942):        at
android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1205)
E/AndroidRuntime(  942):        at
android.app.Activity.performStart(Activity.java:3490)
E/AndroidRuntime(  942):        at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2240)
E/AndroidRuntime(  942):        at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2284)
E/AndroidRuntime(  942):        at
android.app.ActivityThread.access$1800(ActivityThread.java:112)
E/AndroidRuntime(  942):        at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
E/AndroidRuntime(  942):        at
android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(  942):        at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime(  942):        at
android.app.ActivityThread.main(ActivityThread.java:3948)
E/AndroidRuntime(  942):        at
java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(  942):        at
java.lang.reflect.Method.invoke(Method.java:521)


Obviously my lib isn't loading, but I don't know why. Any ideas?

Thanks
-Corey Ling

--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-porting+unsubscr...@googlegroups.com
website:  http://www.***.com/ 
-~----------~----~----~----~------~----~------~--~---

3. How to know it's week when input random date?

4. Buttons/ImageViews overlaid on a GLSurfaceView

5. Android Silicon Valley MeetUp June 16th 鈥?Hosted by Motodev

6. Android Silicon Valley MeetUp J une 16th 鈥?Hosted by Motodev

7. How selective are the Android Marketplace "police" in allowing our apps to be published?