Foro sobre Android > Necesito ayuda con un mMetodo para paypal
Ese útil no creo que sea de java.util. Pon todo el error y todos tus imports para que lo veamos bien!!!

Gracias por la magnífica información - Download Megabox HD Apk and Download Megabox PC

you can download Megabox HD For PC

Hola disculpen la tardanza, esta es la clase con todo el código y sus imports, espero me puedan ayudar, saludos...
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.paypal.android.MEP.PayPal;
import com.paypal.android.MEP.PayPalActivity;
import com.paypal.android.MEP.PayPalAdvancedPayment;
import com.paypal.android.MEP.PayPalPayment;
import com.paypal.android.MEP.PayPalReceiverDetails;
import java.math.BigDecimal;
public class MainActivity extends ActionBarActivity {
public final int PAYPAL_RESPONSE = 100;
EditText editText_friend1_id;
EditText editText_friend1_amount;
EditText editText_friend2_id;
EditText editText_friend2_amount;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
editText_friend1_id = (EditText) findViewById(R.id.editText_friend1_id);
editText_friend1_amount = (EditText) findViewById(R.id.editText_friend1_amount);
editText_friend2_id = (EditText) findViewById(R.id.editText_friend2_id);
editText_friend2_amount = (EditText) findViewById(R.id.editText_friend2_amount);
Button paypal_button = (Button) findViewById(R.id.button_paypal_mpl);
initLibrary();
paypal_button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
PayPalButtonClick(editText_friend1_id.getText().toString(),
editText_friend1_amount.getText().toString(),
editText_friend2_id.getText().toString(),
editText_friend2_amount.getText().toString());
}
});
}
public void initLibrary() {
PayPal pp = PayPal.getInstance();
if (pp == null) {
pp = PayPal.initWithAppID(this, Util.sand_box.id, PayPal.ENV_SANDBOX);
}
}
public void PayPalButtonClick(String primary_id, String primary_amount,
String secoundary_id, String secoundary_amount) {
//Codigo para pago basico en paypal
//PayPalPayment newPayment = new PayPalPayment();
//newPayment.setSubtotal(new BigDecimal("1.0"));
//newPayment.setCurrencyType("MXN");
//newPayment.setRecipient("Email-de-notificacion@hotmail.com");
//newPayment.setMerchantName("Mi compañia");
//Log.d("Pavan", "Llamando intencion");
//if(PayPal.getInstance() != null){
// Log.d("Pavan", "In if");
//Intent paypalIntent = PayPal.getInstance().checkout(newPayment, this);
//startActivityForResult(paypalIntent, 1);
Log.d("pavan", "primary " + primary_id);
Log.d("pavan", "primary_amount " + primary_amount);
Log.d("pavan", "secoundry_amount " + secoundary_amount);
Log.d("pavan", "secoundry_id " + secoundary_id);
//config reciever1
PayPalReceiverDetails receiver0, receiver1;
receiver0 = new PayPalReceiverDetails();
receiver0 .setRecipient(primary_id);
receiver0.setSubtotal(new BigDecimal(primary_amount));
//config reciever2
receiver1 = new PayPalReceiverDetails();
receiver1.setRecipient(secoundary_id);
receiver1.setSubtotal(new BigDecimal(secoundary_amount));
//Agregando tipo de pago
PayPalAdvancedPayment advPayment = new PayPalAdvancedPayment();
advPayment.setCurrencyType("MXN");
advPayment.getReceivers().add(receiver0);
advPayment.getReceivers().add(receiver1);
Intent papalIntent = PayPal.getInstance().checkout(advPayment, this);
this.startActivityForResult(papalIntent, PAYPAL_RESPONSE);
}
public void onActivityResult(int requestCode, int resultCode, Intent data){
Log.d("pavan", "response");
if(requestCode == PAYPAL_RESPONSE){
switch (resultCode){
case Activity.RESULT_OK:
//El pago fue exitoso
String paykey = data.getStringExtra(PayPalActivity.EXTRA_PAY_KEY);
Log.d("pavan", "success" + paykey);
Toast.makeText(getApplicationContext(), "Pago realizado con exito",
Toast.LENGTH_LONG).show();
break;
case Activity.RESULT_CANCELED:
Toast.makeText(getApplicationContext(), "Pago cancelado, intente de nuevo",
Toast.LENGTH_LONG).show();
break;
case PayPalActivity.RESULT_FAILURE:
Toast.makeText(getApplicationContext(), "Fallo el pago, intente de nuevo",
Toast.LENGTH_LONG).show();
break;
}
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
PD: O si ya tienen un ejemplo corriendo de paypal que me puedan facilitar se los agradeceria mucho, estoy programando en android studio 1.5

Buen día, tengo una duda con un metodo para implementar paypal nativa para android, tengo el siguiente metodo:
public void initLibrary() {
PayPal pp = PayPal.getInstance();
if (pp == null) {
pp = PayPal.initWithAppID(this, Util.sand_box.id, PayPal.ENV_SANDBOX);
}
}
Pero en la linea: pp = PayPal.initWithAppID(this, Util.sand_box.id, PayPal.ENV_SANDBOX);
me marca un error el "Util.sand_box.id" en particular la palabra "Util" me la pone en rojo, y me manda un mensaje que dice: Cannot resolve symbol 'Util'
Ah que se debe ese error? tengo todas mis librerias hasta la de import java.util.*;
Espero me puedan ayudar, saludos