Android Listprefence Value for Activity Loop Timer? -


listprefence selected value , service activity in loop time want use value. kind of couldn't.

prefence code;

notificationtimer = (listpreference) findpreference("nofication_timer"); if(notificationtimer.getvalue()==null) { notificationtimer.setvalueindex(0); } notificationtimer.setsummary(notificationtimer.getvalue().tostring()); notificationtimer.setonpreferencechangelistener(new onpreferencechangelistener() { @override public boolean onpreferencechange(preference preference, object newvalue) { preference.setsummary(newvalue.tostring() + " sn."); return true; } }); 

notİfİcatİon servİce code;

@override public void onstart(intent intent, int startid) { if (!isconnected){   zamanlayici = new timer(); yardimci = new handler(looper.getmainlooper()); zamanlayici.scheduleatfixedrate(new timertask() { @override public void run() { new httpasynctask().execute("http://"+url+port+json); } }, 0, tİmer*1000); //lİstprefence select value } else { toast.maketext(context, "sunucu ile bağlantı kurulamadı !!", toast.length_short).show();     } 

array.xml

<?xml version="1.0" encoding="utf-8"?>  <resources>  <string-array name="updateinterval"> <item name="1dk">1 dakika</item> <item name="5dk">5 dakika</item> <item name="15dk">15 dakika</item> <item name="30dk">30 dakika</item> </string-array>  <string-array name="updateintervalvalues"> <item name="1dk">60</item> <item name="5dk">300</item> <item name="15dk">900</item> <item name="30dk">1800</item> </string-array>  </resources> } 


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -