Alex Volovoy Alex Volovoy - 1 year ago 99
Android Question

Is there any way to put extras to Intent from preferences?

Hi i'm launching activity from preferences screen. Activity is shared among three preferences.
I wonder if i can set extras for this activity in xml



i wonder if i can do something like


All i need to do to pass an integer really. I can different actions and check action instead of extras.

Answer Source

As your extras are not constants, you should pass them in the java code instead of xml.

Intent intent = new Intent( this, YourTargetActivity.class );
intent.putExtra( EXTRAS_KEY, extras );
yourPref.setIntent( intent );
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download