Switch case on String

by Abhi » Thu, 24 Sep 2009 22:57:18 GMT


Sponsored Links
 Can I do a switch(String), case (compare with other string) and how?

I am trying to compare string results and perform actions...

Thanks,

Abhi
--~--~---------~--~----~------------~-------~--~----~



Switch case on String

by Felipe Silveira » Fri, 25 Sep 2009 00:50:59 GMT


 No, you can't.

In Java we don't have switch with Strings.

Regards,

Felipe Silveira






-- 
Felipe Silveira
Engenharia da Computao
Universidade Federal de Itajub
 http://www.felipesilveira.com.br 
MSN: felipeuni...@hotmail.com
Skype: fsunifei
-------------------------------------------------

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


Sponsored Links


Switch case on String

by Abhi » Fri, 25 Sep 2009 01:07:52 GMT


 Ok. Thanks Felipe. I just figured that out.

Regards,

Abhi




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



Other Threads

1. WAP Push not working

Hi;
I am trying to get WAP push working. When I send the push message to
the device I see this in the LogCat

06-18 17:19:13.762: DEBUG/dalvikvm(148): GC freed 702 objects / 61496
bytes in 130ms
06-18 17:19:18.792: DEBUG/dalvikvm(143): GC freed 369 objects / 16696
bytes in 152ms
06-18 17:19:25.422: DEBUG/SmsProvider(119): insert url=content://sms/
raw, match=15
06-18 17:19:31.842: DEBUG/WAP PUSH(119): Rx:
c50625aeaf6170706c69636174696f6e2f6d666f726d6174696f6e2e737475622e636c69656e74002123414423212f33635733555563767a6c54584948556e642f76716d776255453168636d31626c46653745593866465648734961563447497a4f31484942693475466a4f4c4e76634463784e4367537649594b303851396b654e6f58586d79636b733268676e664f7364596f4b6a553439517a
06-18 17:19:33.312: INFO/MyFaves(143): starting service with intent:
Intent { flags=0x4 comp={com.tmobile.myfaves/
com.tmobile.myfaves.MyFavesService} (has extras) }
06-18 17:19:33.312: INFO/MyFaves(143): handleMessage(0)
06-18 17:19:33.352: INFO/MyFaves(143): sending msg:
16358279011678220201000000000000000000000000000000000000000000000000000000000000
to 32837
06-18 17:19:33.472: INFO/ActivityManager(64): Stopping service:
com.tmobile.myfaves/.MyFavesService

I have the intent set up and the permission, but the my code is never
called (this works for SMS - so most of the code is right I assume).
Here is the manifest

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.mformation.gStub" android:versionCode="1"
        android:versionName="1.0">
        <application android:icon="@drawable/icon" android:label="@string/
app_name"
                android:debuggable="true">
                <activity android:name=".Engine" 
android:label="@string/app_name"
                        android:debuggable="true">
                        <intent-filter>
                                <action 
android:name="android.intent.action.MAIN" />
                                <category 
android:name="android.intent.category.LAUNCHER" />
                        </intent-filter>
                </activity>

                <receiver android:name="BootReceiver">
                        <intent-filter>
                                <action 
android:name="android.intent.action.BOOT_COMPLETED" />
                                <category 
android:name="android.intent.category.HOME" />
                        </intent-filter>
                </receiver>

                <receiver android:name="SMSReceiver">
                        <intent-filter>
                                <action
android:name="android.provider.Telephony.WAP_PUSH_RECEIVED" />
                                <action 
android:name="android.provider.Telephony.SMS_RECEIVED" />
                        <action android:name="android.Telephony"></action>
</intent-filter>
                </receiver>


</application>
        <uses-permission
android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
        <uses-permission
android:name="android.permission.ACCESS_COARSE_LOCATION" />
        <uses-permission android:name="android.permission.READ_PHONE_STATE" /
        <uses-permission android:name="android.permission.INTERNET" />
        <uses-permission android:name="android.permission.RECEIVE_SMS" />
        <uses-permission android:name="android.permission.INSTALL_PACKAGES" /
        <uses-permission android:name="android.permission.READ_SMS" />
        <uses-permission android:name="android.permission.RECEIVE_MMS" />
        <uses-permission android:name="android.permission.RECEIVE_WAP_PUSH" /
</manifest>

Now this particular message type works in several other types of
device (Symbian and Windows mobile), so I am quite sure the content is
valid.

I have tried platform 1.5 and 1.1. The hardware I am using is an HTC
G1.

Should this work?
If so, any ideas what I can investigate?



One other question - is there any way to stop the continual "myfaves"
SMS? No idea how much that is consting me. I am not using a T-Mobile
SIM.

Regards

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

2. Re : Re : Sharing data between an Android service and an application.

If you only need to provide some parameters at startup, you can do
that in the onbind intent. If you don't need tight coupling between
activity and service and the amount of data is very limited, you can
use sharedpreferences to exchange data.






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

3. Update widget from code

4. Re : Sharing data between an Android service and an application.

5. Android boot hangs at splash screen

6. Performance depending on size of SDRAM?

7. wma and wmv format supportence in android mobile