Android Open Source - DigitalPassbook Add Trans






From Project

Back to project page DigitalPassbook.

License

The source code is released under:

MIT License

If you think the Android project DigitalPassbook listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.android;
//  ww  w  .  ja va 2 s.  c om
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class AddTrans extends Activity{
    /** Called when the activity is first created. */
  SQLiteDatabase db1=null;
  EditText e;
  String s;
  int key,n=0;
  Long acc;
  Cursor c;
  @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main15);
        db1=openOrCreateDatabase("bank.db", Context.MODE_PRIVATE, null);
        key=0;
       Button b=(Button)findViewById(R.id.sb);
       
        b.setOnClickListener(new OnClickListener(){

        @Override
        public void onClick(View v) {
          // TODO Auto-generated method stub
          
          key=0;
          e=(EditText)findViewById(R.id.edt);
          String s=e.getText().toString();
          
          try {c=db1.rawQuery("SELECT AccountNo from Account_Details;", null);
              if(c.moveToFirst());
          do{
        
            Long Ac=c.getLong(0);
            String c=Ac.toString();
                    if(s.equals(c)){
                      
                    key=1;
                    
                    Intent newscreen=new Intent(getApplicationContext(),Update.class);
                  newscreen.putExtra("id",Ac);
                  Log.e("Add Trans",".");
                  
                  startActivity(newscreen);
                  }
                
              }while(c.moveToNext());
          }
          
          catch(Exception e){Toast.makeText(getApplicationContext(), "No Records found", Toast.LENGTH_SHORT).show();
           n=1;}
        if((key==0)&&(n==0))
        {
          Toast.makeText(getApplicationContext(), "Account not found", Toast.LENGTH_SHORT).show();  
        }
        }});
          
  }
}




Java Source Code List

com.android.AccDetails.java
com.android.AddTrans.java
com.android.ListAccount.java
com.android.NewAccount.java
com.android.ProjectActivity.java
com.android.SrcTrans.java
com.android.SrchResults.java
com.android.TransDetails.java
com.android.Trans.java
com.android.Update.java
com.android.ViewTransactions.java
com.android.support.java