android & Smack

by Micka » Wed, 25 Jun 2008 00:07:38 GMT


Sponsored Links
 Hi,

i make a program on Android with the librairy smack.


It's work when i want to connect the server, easy !


but when i want t get the ServiceDiscoveryItem , i've a crash
system ... :


Uncaught handler: thread Main exiting due to uncaught exception

java.lang.RuntimeException: Unable to start activity
ComponentInfo{test.msn/test.msn.msn}: java.lang.ClassCastException:
Lorg/jivesoftware/smack/PacketReader$4;

at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
1758)

at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
1770)

at android.app.ActivityThread.access$1500(ActivityThread.java:99)

at android.app.ActivityThread$H.handleMessage(ActivityThread.java:
1271)
at android.os.Handler.dispatchMessage(Handler.java:80)
at android.os.Looper.loop(Looper.java:91)

at android.app.ActivityThread.main(ActivityThread.java:3052)

at java.lang.reflect.Method.invokeNative(Native Method)

at java.lang.reflect.Method.invoke(Method.java:356)

at android.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1547)

at android.os.ZygoteInit.main(ZygoteInit.java:1445)

at android.dalvik.NativeStart.main(Native Method)
Caused by: java.lang.ClassCastException: Lorg/jivesoftware/smack/
PacketReader$4;

at
org.jivesoftware.smackx.ServiceDiscoveryManager.discoverItems(ServiceDiscoveryManager.java:
462)
at
org.jivesoftware.smackx.ServiceDiscoveryManager.discoverItems(ServiceDiscoveryManager.java:
426)

at test.msn.msn.onCreate(msn.java:39)

at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
847)

at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
1728)

... 11 more


i didn't unserstand!


that is my code to test the connection :

XMPPConnection connexion;

ConnectionConfiguration connConfig = new ConnectionConfiguration(
"xx.xxx.net", 5222);
connexion = new XMPPConnection(connConfig);

try{
connexion.connect();
connexion.login("micka", "micka");
}catch (XMPPException e){

}

ServiceDiscoveryManager serviceDiscoveryManager = new
ServiceDiscoveryManager(
connexion);
try {
serviceDiscoveryManager.discoverItems(connexion.getHost());

// return serviceDiscoveryManager.discoverItems(entityId);
} catch (XMPPException e) {
Log.e("msn","Can't get discovery items for entityId: "+
" : " + e);

} catch(NullPointerException e){

}

the probleme is in the discoveryintems function :(

can you help me ? please !

thank you very much !

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



android & Smack

by Micka » Fri, 27 Jun 2008 01:28:38 GMT


  discovered that the error is here :



smack 3.0.4 :



smack/XMPPConnection.java




if (isFirstInitialization) {
// Notify listeners that a new connection has been established
for (ConnectionCreationListener listener :
connectionEstablishedListeners) {
listener.connectionCreated(this); <== in this line

}
}







can you explain me, what i can do ?



On 24 juin, 17:49, Micka <[EMAIL PROTECTED]> wrote:
--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Other Threads

1. How can I get the near by information such as the hotels,shopes.etc by using latidute and longitude?

I want to get the nearby information such as hotels, shopes,and .etc
by the lat and lgt.
Could I get them not just see thenm on the map?

Thanks a lot
--~--~---------~--~----~------------~-------~--~----~

2. Persistent Data using the Emulator

I am running the emulator with the Eclipse IDE.
I can't get basic persistent storage to work while running within the
emulator.


SharedPreferences mPrefs ;

OnCreate()
{
        mPrefs = getPreferences(MODE_PRIVATE);
       String teststring  = mPrefs.getString("test", "init value") ;
}


Then in the application the user initiates a change like this.

         SharedPreferences.Editor ed = mPrefs.edit();
         ed.putString("test", "new value" );
         ed.commit();


ed.commit() is returning a false which means it failed to store.
Later reading of the saved value shows it was not saved.

I tried this with SharedPreferences with the same result.
My understanding is that getPreferences just does a specific call to
SharedPreferences.

Thanks for any help.
AG


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

3. Apple鈥檚 90 day App Store refund

4. alsa run on real board

5. How to fix landscape mode when boot on device?

6. How do I pass data in an intent from an activity started from the launcher?

7. How do the services communicate with each others ?