asfman
asfman

Reputation: 511

about receiver intent-filter action

    <receiver android:name=".receiver.ReLoginReceiver">
        <intent-filter>
            <action android:name="@string/xxx" />
        </intent-filter>
    </receiver>

if i write action name "@string/xxx", and xxx defined in strings.xml com.aizheke.aizheked.action.reLogin, then i use sendBroadcast(new Intent(getString(R.string.xxx))), receiver can't be called. But if i changed action's android:name , then i can receive the broadcast. I wonder why receiver can't define action like this:?

Upvotes: 1

Views: 214

Answers (1)

hackbod
hackbod

Reputation: 91331

You do not use string resources for action names and other such things. These are not strings that are to be localized, these are strictly defined programmatic names, like method names.

Upvotes: 2

Related Questions