Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

Android - Preference onCreateView attrs.getAttributeCount() -


how "max" attribute during oncreateview()? if can attrs.getattributecount() work solve problem.

<?xml version="1.0" encoding="utf-8"?>     <preferencescreen         xmlns:android="http://schemas.android.com/apk/res/android"         android:title="@string/livewallpaper_settings"         android:key="livewallpaper_settings"     >         <com.example.myapp.seekbarpreference1             android:persistent="true"             android:key="keyitems"             android:title="items"             android:defaultvalue="50"             android:max="200" />         <com.example.myapp.seekbarpreference1             android:persistent="true"             android:key="keyitemstwo"             android:title="items two"             android:defaultvalue="5"             android:max="10" />     </preferencescreen>   

here simplified class. xmlpullparser not return parse.

    public final class seekbarpreference1 extends preference implements onseekbarchangelistener {          private static int _maxvalue = 0;         private int _currentvalue = 0;         private textview _value;         private sharedpreferences _preferences;          public seekbarpreference1(context context, attributeset attrs) {             super(context, attrs);             _preferences = preferencemanager.getdefaultsharedpreferences(context);              //             // these values correct             //             log.d("prefs", " ");             log.d("prefs", "seekbarpreference1");             log.d("prefs", "key: " + getkey());             log.d("prefs", "attrcount: " + attrs.getattributecount());             log.d("prefs", "####");         }          @override         protected view oncreateview(viewgroup parent) {              xmlpullparser attrs = parent.getresources().getxml(r.xml.livewallpaper_settings);              log.d("prefs", " ");             log.d("prefs", "oncreateview");             log.d("prefs", "key: " + getkey()); // correct key output             log.d("prefs", "attrcount: " + attrs.getattributecount()); // -1             log.d("prefs", "####");            } } 

log output

seekbarpreference1 key: keyitems attrcount: 7 ####  seekbarpreference1 key: keyitemstwo attrcount: 7 ####  oncreateview key: keyitems attrcount: -1 ####  oncreateview key: keyitemstwo attrcount: -1 #### 

it seems me if can correct key, title, summery, etc. (from oncreateview) there should simple way other attributes.?

if try , store attributes seekbarpreference1(), lost oncreateview() called.

summery: attributes current "this" oncreateview();

i got figured out.

public seekbarpreference1(context context, attributeset attrs) {     super(context, attrs);     _preferences = preferencemanager.getdefaultsharedpreferences(context);      // save shared prefs here     // saved seekbar max && current value     // below     (int = 0; < attrs.getattributecount(); i++) {         if (attrs.getattributename(i).equals("max"))             _preferences.edit().putstring(getkey() +"max", ""+                      attrs.getattributevalue(i)).commit();     } } 

then retrieve data oncreateview()

protected view oncreateview(viewgroup parent) {      // retrieve data     // have correct data     _maxvalue = integer.parseint(_preferences.getstring(getkey() +"max", ""));  } 

now can use same class multiple times, finally...


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -