Android PayPal支付页面未显示

Android PayPal支付页面未显示,android,Android,我正在创建用于测试的paypal应用程序。我已经创建了测试paypal帐户,并在我的活动中单击按钮编写了下面给出的代码。但没有什么是显示和获取异常: 09-26 13:52:51.908: E/NetworkHandler(540): postXML caught exception doing I/O, mobileclient.sandbox.paypal.com 代码: 我的应用程序中有Internet权限。请帮帮我。我不知道这是否正确。但是我通过在你的代码之前创建internet连接找

我正在创建用于测试的paypal应用程序。我已经创建了测试paypal帐户,并在我的活动中单击按钮编写了下面给出的代码。但没有什么是显示和获取异常:

09-26 13:52:51.908: E/NetworkHandler(540): postXML caught exception doing I/O, mobileclient.sandbox.paypal.com
代码:


我的应用程序中有Internet权限。请帮帮我。

我不知道这是否正确。但是我通过在你的代码之前创建internet连接找到了解决方案,他联系Vikalp patel来识别
你找到了NetworkHandler错误的解决方案了吗

public void PayPalButtonClick_ ( View v )
{
    class asynctaskToInitLibrary extends AsyncTask<String, Integer, String >
    {
        @Override
        protected String doInBackground(String... params) 
        {

            URL actualUrl = null;
            try 
            {
                actualUrl = new URL("http://www.google.com") ;
            } 
            catch (MalformedURLException e) 
            {
                e.printStackTrace();
            }
            try 
            {
                HttpURLConnection cn = (HttpURLConnection)actualUrl.openConnection();
                Log.i(cn.getResponseMessage(),"tushar:connectionResponse") ;
            } 
            catch (IOException e) 
            {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

            PayPal pp = PayPal.getInstance();

            // If the library is already initialized, then we don't need to initialize it again.
            if(pp == null) 
            {
                // This is the main initialization call that takes in your Context, the Application ID, and the server you would like to connect to.
                pp = PayPal.initWithAppID(Paypal_MPL.this, "APP-80W284485P519543T", PayPal.ENV_SANDBOX );

                // -- These are required settings.
                pp.setLanguage("en_US"); // Sets the language for the library.
                // --

                // -- These are a few of the optional settings.
                // Sets the fees payer. If there are fees for the transaction, this person will pay for them. Possible values are FEEPAYER_SENDER,
                // FEEPAYER_PRIMARYRECEIVER, FEEPAYER_EACHRECEIVER, and FEEPAYER_SECONDARYONLY.
                pp.setFeesPayer(PayPal.FEEPAYER_EACHRECEIVER); 
                // Set to true if the transaction will require shipping.
                pp.setShippingEnabled(true);
                // Dynamic Amount Calculation allows you to set tax and shipping amounts based on the user's shipping address. Shipping must be
                // enabled for Dynamic Amount Calculation. This also requires you to create a class that implements PaymentAdjuster and Serializable.
                pp.setDynamicAmountCalculationEnabled(false);
                // --
            }

            if (pp.isLibraryInitialized()) 
            {
                return "initialized" ;
            }
            else 
            {
                return "not-initialized" ;
            }
        }
        protected void onPostExecute(String result)
        {
            initializationStatus ( result ) ;
        }
    }

    asynctaskToInitLibrary object = new asynctaskToInitLibrary() ;
    object.execute("") ;
}
public void paypalbutton单击(视图v)
{
类asynctaskToInitLibrary扩展了AsyncTask
{
@凌驾
受保护的字符串doInBackground(字符串…参数)
{
URL实际URL=null;
尝试
{
实际URL=新URL(“http://www.google.com") ;
} 
捕获(格式错误)
{
e、 printStackTrace();
}
尝试
{
HttpURLConnection cn=(HttpURLConnection)actualUrl.openConnection();
Log.i(cn.getResponseMessage(),“tushar:connectionResponse”);
} 
捕获(IOE异常)
{
//TODO自动生成的捕捉块
e、 printStackTrace();
}
PayPal pp=PayPal.getInstance();
//如果库已经初始化,那么我们不需要再次初始化它。
if(pp==null)
{
//这是在您的上下文、应用程序ID和要连接到的服务器中进行的主要初始化调用。
pp=PayPal.initWithAppID(PayPal_MPL.this,“APP-80W284485P519543T”,PayPal.ENV_沙盒);
//--这些是必需的设置。
pp.setLanguage(“en_US”);//设置库的语言。
// --
//--这些是一些可选设置。
//设置费用付款人。如果有交易费用,此人将支付。可能的值为FEEPAYER\u SENDER,
//付款人为主要接收人,付款人为各接收人,付款人为第二接收人。
pp.setFeesPayer(PayPal.FEEPAYER\u每个接收者);
//如果事务需要发货,则设置为true。
pp.setShippingEnabled(真);
//动态金额计算允许您根据用户的发货地址设置税款和发货金额。发货必须是
//已启用动态金额计算。这还要求您创建一个实现PaymentAdjuster和Serializable的类。
pp.SetDynamicCountCalculationEnabled(假);
// --
}
if(pp.isLibraryInitialized())
{
返回“已初始化”;
}
其他的
{
返回“未初始化”;
}
}
受保护的void onPostExecute(字符串结果)
{
初始化状态(结果);
}
}
asynctaskToInitLibrary对象=新建asynctaskToInitLibrary();
对象。执行(“”);
}

我不知道这是否正确。但是我通过在你的代码之前创建internet连接找到了解决方案,他联系Vikalp patel来识别
你找到了NetworkHandler错误的解决方案了吗

public void PayPalButtonClick_ ( View v )
{
    class asynctaskToInitLibrary extends AsyncTask<String, Integer, String >
    {
        @Override
        protected String doInBackground(String... params) 
        {

            URL actualUrl = null;
            try 
            {
                actualUrl = new URL("http://www.google.com") ;
            } 
            catch (MalformedURLException e) 
            {
                e.printStackTrace();
            }
            try 
            {
                HttpURLConnection cn = (HttpURLConnection)actualUrl.openConnection();
                Log.i(cn.getResponseMessage(),"tushar:connectionResponse") ;
            } 
            catch (IOException e) 
            {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

            PayPal pp = PayPal.getInstance();

            // If the library is already initialized, then we don't need to initialize it again.
            if(pp == null) 
            {
                // This is the main initialization call that takes in your Context, the Application ID, and the server you would like to connect to.
                pp = PayPal.initWithAppID(Paypal_MPL.this, "APP-80W284485P519543T", PayPal.ENV_SANDBOX );

                // -- These are required settings.
                pp.setLanguage("en_US"); // Sets the language for the library.
                // --

                // -- These are a few of the optional settings.
                // Sets the fees payer. If there are fees for the transaction, this person will pay for them. Possible values are FEEPAYER_SENDER,
                // FEEPAYER_PRIMARYRECEIVER, FEEPAYER_EACHRECEIVER, and FEEPAYER_SECONDARYONLY.
                pp.setFeesPayer(PayPal.FEEPAYER_EACHRECEIVER); 
                // Set to true if the transaction will require shipping.
                pp.setShippingEnabled(true);
                // Dynamic Amount Calculation allows you to set tax and shipping amounts based on the user's shipping address. Shipping must be
                // enabled for Dynamic Amount Calculation. This also requires you to create a class that implements PaymentAdjuster and Serializable.
                pp.setDynamicAmountCalculationEnabled(false);
                // --
            }

            if (pp.isLibraryInitialized()) 
            {
                return "initialized" ;
            }
            else 
            {
                return "not-initialized" ;
            }
        }
        protected void onPostExecute(String result)
        {
            initializationStatus ( result ) ;
        }
    }

    asynctaskToInitLibrary object = new asynctaskToInitLibrary() ;
    object.execute("") ;
}
public void paypalbutton单击(视图v)
{
类asynctaskToInitLibrary扩展了AsyncTask
{
@凌驾
受保护的字符串doInBackground(字符串…参数)
{
URL实际URL=null;
尝试
{
实际URL=新URL(“http://www.google.com") ;
} 
捕获(格式错误)
{
e、 printStackTrace();
}
尝试
{
HttpURLConnection cn=(HttpURLConnection)actualUrl.openConnection();
Log.i(cn.getResponseMessage(),“tushar:connectionResponse”);
} 
捕获(IOE异常)
{
//TODO自动生成的捕捉块
e、 printStackTrace();
}
PayPal pp=PayPal.getInstance();
//如果库已经初始化,那么我们不需要再次初始化它。
if(pp==null)
{
//这是在您的上下文、应用程序ID和要连接到的服务器中进行的主要初始化调用。
pp=PayPal.initWithAppID(PayPal_MPL.this,“APP-80W284485P519543T”,PayPal.ENV_沙盒);
//--这些是必需的设置。
pp.setLanguage(“en_US”);//设置库的语言。
// --
//--这些是一些可选设置。
//设置费用付款人。如果有交易费用,此人将支付。可能的值为FEEPAYER\u SENDER,
//付款人为主要接收人,付款人为各接收人,付款人为第二接收人。
pp.setFeesPayer(PayPal.FEEPAYER\u每个接收者);
//如果事务需要发货,则设置为true。
pp.setShippingEnabled(真);
//动态金额计算允许您根据用户的发货地址设置税款和发货金额。发货必须是
//已启用动态金额计算。这还要求您创建一个实现PaymentAdjuster和Serializable的类。
pp.SetDynamicCountCalculationEnabled(假);
// --
}
if(pp.isLibraryInitialized())
{
返回“已初始化”;
}
其他的
{
返回“未初始化”;
}
}
普罗特