DIMOS
DIMOS

Reputation: 29

Android call makePayment how

i want to call makePayment(); I want to automatically run ...... This is my code

package com.musicdownloader;


import com.fortumo.android.PaymentActivity;
import com.musicdownloader.R;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import android.view.View.OnClickListener;

public class app extends PaymentActivity {

       public void onCreate(Bundle savedInstanceState) {
           makePayment();    
           super.onCreate(savedInstanceState);
               setContentView(R.layout.main);

               Button payButton = (Button) findViewById(R.id.Next);
               payButton.setOnClickListener(new OnClickListener() {
                   public void onClick(View v) {
                           final EditText q = (EditText) findViewById(R.id.q);
                            Intent i = new Intent("android.intent.action.VIEW", Uri.parse("http://www.google.com/search?q=" +q.getText().toString()));
                            startActivity(i);

                       }
               });

       }
       @Override
       protected void onPaymentCanceled(String product) {
               Toast.makeText(this, "Payment canceled by user", Toast.LENGTH_SHORT).show();
       }

       @Override
       protected void onPaymentFailed(String product) {
               Toast.makeText(this, "Payment failed", Toast.LENGTH_SHORT).show();
       }

       @Override
       protected void onPaymentPending(long messageId, String product) {
               Toast.makeText(this, "Payment not confirmed", Toast.LENGTH_SHORT).show();
       }

       @Override
       protected void onPaymentSuccess(String product) {
               Toast.makeText(this, "Payment received", Toast.LENGTH_SHORT).show();
       }

How to call it?? Thank you

Upvotes: 0

Views: 80

Answers (1)

Sebastian Roth
Sebastian Roth

Reputation: 11537

You should call it in your onStart method, after you called super.onStart.

Upvotes: 1

Related Questions