android - How to get information from another intent? -


i new on android , don't understand how broadcast receiver works. in app have intent extends broadcast receiver, , have xmlfile edittextpreference. how text on xml file broadcast receiver intent?

this xmlfile(res/xml/prefs.xml):

<?xml version="1.0" encoding="utf-8"?> <preferencescreen xmlns:android="http://schemas.android.com/apk/res/android" >      <edittextpreference          android:title="edittext"         android:key="name"         android:summary="enter name"         />     </preferencescreen> 

you can add information intent this:

intent = new intent(); i.putextra("preferencestext", textyoumeantosend); 

and in broadcast reciever can call string:

getintent().getstringextra("preferencestext", somedefaultvalue); 

edit

from http://developer.android.com/reference/android/content/broadcastreceiver.html

a broadcastreceiver receive callbock on onreceive(context context, intent intent) callback, dont have call getintent(), have @ point

so, move retrieving code onreceive , change to:

intent.getstringextra("preferencestext", somedefaultvalue); 

Comments

Popular posts from this blog

Python Kivy ListView: How to delete selected ListItemButton? -

asp.net mvc 4 - A specified Include path is not valid. The EntityType '' does not declare a navigation property with the name '' -