[android-developers] Evaluate javascript value on WebView, Android
hi, I open a webview page that page have var addToBasketDisabled=false; var iPhoneStatus=; function GetStatus() { return iPhoneStatus;//Master Pagelerde tanımlı } var path = http://www.yemeksepeti.com/App_Themes/Default_tr-TR/images/ IPhone/; function PreLoadDisabledButton() { var image = new Image(); image.src=path + Iphone-button-ekle-pasif.png; } function DisableAddButton() { addToBasketDisabled= true; var buttonObject = document.getElementById(ctl00_AddToBasket); buttonObject.src = path + Iphone-button-ekle-pasif.png; } function EnableAddButton() { addToBasketDisabled= false; var buttonObject = document.getElementById(ctl00_AddToBasket); buttonObject.src = path + Iphone-button-ekle.png; } function OnAddButtonClick() { if(addToBasketDisabled) { return false; } DisableAddButton(); var validateValue= ValidateInput(); if(!validateValue) { EnableAddButton(); return false; } } PreLoadDisabledButton(); these javascript When I press a button on the webview I have to read the iPhoneStatus value and close the webview screen and decide the result. I wrote these codes in my .java class mWebView = (WebView) findViewById(R.id.webview); WebSettings webSettings = mWebView.getSettings(); webSettings.setSavePassword(false); webSettings.setSaveFormData(false); webSettings.setJavaScriptCanOpenWindowsAutomatically(true); webSettings.setJavaScriptEnabled(true); webSettings.setSupportZoom(false); mWebView.setWebChromeClient(new MyWebChromeClient()); mWebView.addJavascriptInterface(new DemoJavaScriptInterface(), demo); mWebView.loadUrl(feedurl); final class DemoJavaScriptInterface { DemoJavaScriptInterface() { } public void clickOnAndroid() { mHandler.post(new Runnable() { public void run() { mWebView.loadUrl(javascript: GetStatus()); } }); } } final class MyWebChromeClient extends WebChromeClient { public void onCloseWindow(WebView window) { window.destroy(); } public boolean onJsAlert(WebView view, String url, String message, JsResult result) { Log.i(log , message); result.confirm(); return true; } } But it never go in the onJsAlert method, is there any way to evaluate the value of GetStatus() Thanks -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] org.apache.http.auth Problem
0 down vote favorite Hi, I used org.apache.http.auth and develop demo code samples like this: DefaultHttpClient httpclient = new DefaultHttpClient(); httpclient.getCredentialsProvider().setCredentials( new AuthScope(www.yemeksepeti.com, 80), new UsernamePasswordCredentials(***, ***)); BasicHttpContext localcontext = new BasicHttpContext(); BasicScheme basicAuth = new BasicScheme(); localcontext.setAttribute(preemptive-auth, basicAuth); // Add as the first request interceptor httpclient.addRequestInterceptor(new PreemptiveAuth(), 0); HttpHost targetHost = new HttpHost(www.yemeksepeti.com, 80, http); HttpGet httpget = new HttpGet(/YemeksepetiCatalogWebService/ CatalogExportMobile.asmx/Mobile_GetCities); String responseStr = ; HttpResponse response = httpclient.execute(targetHost, httpget, localcontext); HttpEntity entity = response.getEntity(); InputStream is2 = response.getEntity().getContent(); BufferedInputStream bis2 = new BufferedInputStream(is2); ByteArrayBuffer baf2 = new ByteArrayBuffer(1000); int current = 0; while ((current = bis2.read()) != -1) { baf2.append((byte) current); } responseStr = new String(baf2.toByteArray()); if (entity != null) { entity.consumeContent(); } httpclient.getConnectionManager().shutdown(); and add a class : static class PreemptiveAuth implements HttpRequestInterceptor { public void process( final HttpRequest request, final HttpContext context) throws HttpException, IOException { AuthState authState = (AuthState) context.getAttribute( ClientContext.TARGET_AUTH_STATE); // If no auth scheme avaialble yet, try to initialize it preemptively if (authState.getAuthScheme() == null) { AuthScheme authScheme = (AuthScheme) context.getAttribute( preemptive-auth); CredentialsProvider credsProvider = (CredentialsProvider) context.getAttribute( ClientContext.CREDS_PROVIDER); HttpHost targetHost = (HttpHost) context.getAttribute( ExecutionContext.HTTP_TARGET_HOST); if (authScheme != null) { Log.v(TANIMLAMA OZGE,target host + targetHost.getHostName() + + targetHost.getPort()); Credentials creds = credsProvider.getCredentials( new AuthScope( targetHost.getHostName(), targetHost.getPort())); if (creds == null) { throw new HttpException(No credentials for preemptive authentication); } authState.setAuthScheme(authScheme); authState.setCredentials(creds); } } } } } But it gives that messages; I couldn't solve the problem. Have you any idea? Authentication error: basic authorization challenge expected, but not found Default buffer size used in BufferedInputStream constructor. It would be better to be explicit if an 8k buffer is required. You are not authorized to view this page You are not authorized to view this page You do not have permission to view this directory or page using the credentials that you supplied because your Web browser is sending a WWW-Authenticate header field that the Web server is not configured to accept. Please try the following: * Contact the Web site administrator if you believe you should be able to view this directory or page. * Click the Refresh button to try again with different credentials. HTTP Error 401.2 - Unauthorized: Access is denied due to server configuration. Internet Information Services (IIS) Technical Information (for support personnel) * Go to Microsoft Product Support Services and perform a title search for the words HTTP and 401. * Open IIS Help, which is accessible in IIS Manager (inetmgr), and search for topics titled About Security, Authentication, and About Custom Error Messages. Thanks -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Get the touch direction on Android
Hi, I want to ask that is that possible do in android catch the in the touch mode catch the scrolling direction ? When user touch on the screen left to right, can I catch the change ? If it is possible which listener can ı use ? I found some of the methods and listeners but I 'm not sure that therse are represent my requirement . http://developer.android.com/reference/android/text/method/Touch.html Public Methods static int getInitialScrollX(TextView widget, Spannable buffer) static int getInitialScrollY(TextView widget, Spannable buffer) If these methods enough, ıs there any example that including these methods? Thanks -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] WebServis authentication problem, Android
Hi, I have an web service on developed .net The Url is : www.yemeksepeti.com/YemeksepetiCatalogWebService/CatalogExportMobile.asmx I want to use the service methods is : Mobile_GetCities SOAP 1.1 The following is a sample SOAP 1.1 request and response. The placeholders shown need to be replaced with actual values. POST /YemeksepetiCatalogWebService/CatalogExportMobile.asmx HTTP/1.1 Host: www.yemeksepeti.com Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: http://tempuri.org/Mobile_GetCities; ?xml version=1.0 encoding=utf-8? soap:Envelope xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/; soap:Body Mobile_GetCities xmlns=http://tempuri.org/; / /soap:Body /soap:Envelope HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: length ?xml version=1.0 encoding=utf-8? soap:Envelope xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/; soap:Body Mobile_GetCitiesResponse xmlns=http://tempuri.org/; Mobile_GetCitiesResultxml/Mobile_GetCitiesResult /Mobile_GetCitiesResponse /soap:Body /soap:Envelope Here is the Soap Methods And here is the get and set methods HTTP GET The following is a sample HTTP GET request and response. The placeholders shown need to be replaced with actual values. GET /YemeksepetiCatalogWebService/CatalogExportMobile.asmx/Mobile_GetCities? HTTP/1.1 Host: www.yemeksepeti.com HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: length ?xml version=1.0? xml HTTP POST The following is a sample HTTP POST request and response. The placeholders shown need to be replaced with actual values. POST /YemeksepetiCatalogWebService/CatalogExportMobile.asmx/Mobile_GetCities HTTP/1.1 Host: www.yemeksepeti.com Content-Type: application/x-www-form-urlencoded Content-Length: length HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: length ?xml version=1.0? xml The web service have an authentication, the username and password must enter in. I try to diffirent ways on connect the webservice and take the xml file result. But I couldnt success. I tried to connect httpClient, ı try to set the authentication password and like Then I tried connect the webservice with ksoap2 methods. Could you show me a way ? Which way I should to go? I read lots of forum thread about, Calling a web service from Android and How to do HTTP authentication in android like that.. Thanks for your heplness -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Simple Chat Application
Hi, I start to develop an application, In my apllciation needs a instant messaging. Client user can write a person who is live support. I only find Bluetoot Chat service. Is any one develop simple chat in android ? Can anyone show my way ? Filiz Gökçe -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en