java - android setVisibility sometimes works sometimes not -
im having trouble setvisibility when app goes background , bring foreground after setvisibility(view.visible) not work correctly have socket
private emitter.listener onnewrequest = new emitter.listener() { @override public void call(final object... args) { mainmapactivity.this.runonuithread(new runnable() { @override public void run() { jsonobject objectrequet = (jsonobject) args[0]; setcomponentvisible(); } }); } };
and function is
public void setcomponentvisible() { runonuithread(new runnable() { @override public void run() { llacceptreject.setvisibility(view.visible); llacceptreject.requestlayout(); lluserdetailview.setvisibility(view.visible); lluserdetailview.requestlayout(); } }); playbeep(); phelper.putjsonstring(requeststr); phelper.putpending(true); starttimerremain(); destinationtxt.settext("origen: " +originstr); }
and layout xmol file
<fragment android:id="@+id/map" android:name="com.google.android.gms.maps.supportmapfragment" android:layout_width="match_parent" android:layout_height="fill_parent" android:layout_alignwithparentifmissing="false" android:layout_margintop="40dp" /> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignparentbottom="true" android:orientation="vertical" android:weightsum="1" android:textalignment="center"> <include android:id="@+id/clientdetailview" layout="@layout/include_detail_view" android:visibility="gone" /> <linearlayout android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="40dp" android:layout_alignparentbottom="false" android:layout_alignparentleft="false" android:baselinealigned="false" android:layout_centerinparent="true" android:gravity="center_vertical|center_horizontal" android:layout_alignparenttop="true" android:id="@+id/swhide" android:background="#c7030303"> <switch android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="disponibilidad" android:id="@+id/switchabiable" android:layout_alignparentbottom="true" android:layout_alignparentleft="true" android:layout_alignparentstart="true" android:paddingright="15dp" android:textcolor="#f8f7f7" android:textoff="off" android:texton="on" android:textsize="24dp" /> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancesmall" android:text="small text" android:id="@+id/versiontxt" android:layout_above="@+id/switchabiable" android:layout_alignparentleft="true" android:layout_alignparentstart="true" android:layout_marginleft="15dp" android:visibility="visible" android:textcolor="#fefcfc" /> <button android:id="@+id/btnclientreqremaintime" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:layout_centerhorizontal="true" android:layout_marginbottom="30dp" android:background="@drawable/round_button" android:gravity="center" android:text="58" android:textcolor="@color/color_blue" android:textsize="@dimen/dimen_waiting_time" android:visibility="gone" /> </linearlayout> <linearlayout android:id="@+id/llacceptreject" android:layout_width="wrap_content" android:layout_height="match_parent" android:orientation="horizontal" android:visibility="gone"> <button android:id="@+id/btnclientaccept" android:layout_width="200dp" android:layout_height="73dp" android:layout_alignparentbottom="true" android:layout_gravity="bottom" android:background="@mipmap/botonaceptar" android:gravity="center" android:textcolor="@color/white" android:layout_weight="0.5" /> <imageview android:id="@+id/ivdivider" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@null" android:src="@drawable/divider" android:visibility="gone" /> <button android:id="@+id/btnclientreject" android:layout_width="200dp" android:layout_height="73dp" android:layout_alignparentbottom="true" android:layout_gravity="bottom" android:layout_weight="0.5" android:background="@mipmap/botoncancelarpeticion" android:gravity="center" android:textcolor="@color/white" /> </linearlayout>
te problem occurs when view reloaded after time of inactivity please helpme!
Comments
Post a Comment