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.

java - Android: Chronometer in ListView Row? -


i got row xml listview chronometer


<linearlayout android:layout_width="fill_parent" android:id="@+id/layout_orders_list_row_ll_timer"  android:focusable="false"    android:layout_height="wrap_content"  android:gravity="center_horizontal|right" android:layout_gravity="center"> <chronometer android:text="@+id/chronometer01"     android:layout_height="wrap_content" android:layout_width="wrap_content"     android:id="@+id/layout_orders_list_row_chr_timer"     android:focusable="false" android:focusableintouchmode="false"     android:layout_gravity="center" android:enabled="true"> </chronometer> <button android:background="@drawable/check" android:layout_height="wrap_content"      android:id="@+id/layout_orders_list_row_bt_done"      android:layout_width="wrap_content" android:focusable="false"                   android:onclick="onrowbuttonclick"> </button> 


and want start chronometer each row.i'm getting data database , fill adapter.after i'm connecting each chronometer , trying calculate it.but doesn't work.

    simpleadapter simpleadapter = new simpleadapter(this, fillmaps,             r.layout.orders_list_row, from, to);      listview.setadapter(simpleadapter);         (int = 0; < simpleadapter.getcount(); i++) {          linearlayout vwparentrow = (linearlayout) simpleadapter.getview(i,                 null, null);          linearlayout childtop = (linearlayout) vwparentrow.getchildat(0);         linearlayout childtop2 = (linearlayout) childtop.getchildat(1);         final chronometer chrono = (chronometer) childtop2.getchildat(0);         chrono.settext("00:00:00");         chrono.setbase(systemclock.elapsedrealtime());         chrono.start();          chrono.setonchronometerticklistener(new onchronometerticklistener() {              public void onchronometertick(chronometer arg0) {                 // todo auto-generated method stub                      long minutes = ((elapsedtime - chrono.getbase()) / 1000) / 60;                     long seconds = ((elapsedtime - chrono.getbase()) / 1000) % 60;                     currenttime = minutes + ":" + seconds;                     arg0.settext(currenttime);                     elapsedtime = elapsedtime + 1000;              }          });      }      listview.invalidate(); 

what i'm doing wrong? maybe there other solution how start chronometer in each row?

to deal problem, created own adapter, since there no standard valuable option suits solution.


public class simpleadapterwithcheckbox extends simpleadapter {   public simpleadapterwithcheckbox(context context,         list<? extends map<string, ?>> data, int resource, string[] from,         int[] to) {     super(context, data, resource, from, to);  }   // method getview start each row in adapter show in listview  public view getview(int position, view convertview, viewgroup parent) {                         view v = super.getview(position, convertview, parent);         startchrono(v);// starting each row         return v;            }    private void  startchrono(view v){      //here need know structure of layout our element      linearlayout vwparentrow = (linearlayout)v;     linearlayout childtop = (linearlayout) vwparentrow.getchildat(0);     linearlayout childtop2 = (linearlayout) childtop.getchildat(1);      //now, chronometer , work wont     chronometer chrono = (chronometer) childtop2.getchildat(0);     chrono.setbase(systemclock.elapsedrealtime());     chrono.start();   } 

}


this not best case scenario, works fine me.


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 -