0

Command Executed :

  arguments.toSource();

I am getting the below error when I am accessing the arguments in any function to display the arguments.

  TypeError: Object #<Object> has no method 'toSource'

Is arguments is array or not ?


How to determine the network unavailability in android

I want to show alert that connection not available in my android application.

I am calling some rest request in my application. To check this network unavailability scenario I manually disconnect my wifi in my laptop (I am testing in simulator) .

Code where I call service is here

resp = client.execute(httpPostRequest);

and here I am catching exception

catch (IllegalStateException e) {
            //assertTrue(e.getLocalizedMessage(), false);
            e.printStackTrace();
        } catch (ClientProtocolException e) {
            //assertTrue(e.getLocalizedMessage(), false);
            e.printStackTrace();
        } catch (IOException e) {
            //assertTrue(e.getLocalizedMessage(), false);
            e.printStackTrace();
        }

and when I get exception I try to get the status of the device network connection with this function

public boolean IsInternetConnectted()
    {
        ConnectivityManager conMgr =  (ConnectivityManager)this.getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo i = conMgr.getActiveNetworkInfo();
        conMgr = null;
        if (i == null)
            return false;
        if (!i.isConnected())
            return false;
        if (!i.isAvailable())
            return false;
        return true;        
    }

even if wi-fi is disconnected my simulator return true from this function.

How to resolve this situaltion??

4

1 に答える 1

1

argumentsは配列に似ていますが、完全な JavaScript ではありませんArray

toSourceメソッドはありません。ドキュメントを参照してください。

于 2012-11-05T13:33:02.033 に答える