Need Web service sample code for me(Beginner)

by » 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?


-- Ward


2. JNI Running

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

This is my source:

package corey.nativetest;

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. */
    public void onCreate(Bundle savedInstanceState) {

    protected void onStart() {
        // TODO Auto-generated method stub
    static {
        try {
            Log.i("JNI", "Trying to load");
        catch (UnsatisfiedLinkError ule) {
            Log.e("JNI", "WARNING: Could not load");

#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:

adb push /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
W/SurfaceFlinger(  582): executeScheduledBroadcasts() skipped, contention on
 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
E/JNI     (  942): WARNING: Could not load
D/dalvikvm(  942): +++ not scanning '/system/lib/' for 'print'
(wrong CL)
D/dalvikvm(  942): +++ not scanning '/system/lib/' 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
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(
E/AndroidRuntime(  942):        at
E/AndroidRuntime(  942):        at
E/AndroidRuntime(  942):        at
E/AndroidRuntime(  942):        at
E/AndroidRuntime(  942):        at$1800(
E/AndroidRuntime(  942):        at$H.handleMessage(
E/AndroidRuntime(  942):        at
E/AndroidRuntime(  942):        at android.os.Looper.loop(
E/AndroidRuntime(  942):        at
E/AndroidRuntime(  942):        at
java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(  942):        at

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

-Corey Ling

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?