Tuesday, October 8, 2013

[android help] Can not update Value


Can not update Value



I have a class(constant.class). Which contain all the constant value that needs to be updated. I have a method in main activity. It update constant value(a url) and execute a view class(contain webview). But the value of url can not update in constant.class. so in the view the webview looks white. I have to update the value of url in constant.class. here is my constant class:



public class Constant {

public static boolean isCapturedOk = false;

public static int imagePickerStatus = -1;

public static byte[] imageData;

public static int result = 0;

public static String printUrl = "";

public static String rotationValue="";

public static String rotationValueForCamera="";

public static boolean isPrintButtonVisible = true;


}


Here is my View class:



public class PrintView extends LinearLayout {

WebView wev;
public PrintView(Context context) {
super(context);
// TODO Auto-generated constructor stub
View.inflate(context, R.layout.printscreen, this);
wev = (WebView) findViewById(R.id.webViewPrint);
wev.loadUrl("http://www.vividworks.com/");

}

public PrintView(Context context, AttributeSet attrs, int defStyle) {
super(context);
// TODO Auto-generated constructor stub
View.inflate(context, R.layout.printscreen, this);
wev = (WebView) findViewById(R.id.webViewPrint);
wev.loadUrl("http://www.vividworks.com/");

}

public PrintView(Context context, AttributeSet attrs) {
super(context);
// TODO Auto-generated constructor stub
View.inflate(context, R.layout.printscreen, this);
wev = (WebView) findViewById(R.id.webViewPrint);
wev.loadUrl("http://www.vividworks.com/");

}



@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
// TODO Auto-generated method stub
for(int i = 0 ; i < getChildCount() ; i++){
getChildAt(i).layout(l, t, r, b);
}
}


}


Here is the method in main activity:



public void loadPrintActivity(String printUrl){
Constant.printUrl = printUrl;
Constant.isPrintButtonVisible =true;
pv.setVisibility(View.VISIBLE);}


Read more

stackoverflow.comm



No comments:

Post a Comment

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...