Exemplo n.º 1
0
 public void onPressClear(View view) {
   // Do something in response to button
   DataBaseHelper databasehelper = new DataBaseHelper(this);
   SQLiteDatabase db = databasehelper.getWritableDatabase();
   if (db != null) {
     // Se elimina la versión anterior de la tabla
     db.execSQL("DROP TABLE IF EXISTS " + databasehelper.TABLA);
     // Se utiliza para poder crear la nueva base de datos
     databasehelper.onCreate(db);
   }
 }
Exemplo n.º 2
0
  // metodo para insertar a la tabla
  private void insertPrso(String nombre, String ciudad) {
    DataBaseHelper databasehelper = new DataBaseHelper(this);
    SQLiteDatabase db = databasehelper.getWritableDatabase();
    if (db != null) {
      ContentValues cv = new ContentValues();
      cv.put(DataBaseHelper.NOMBRE, nombre);
      cv.put(DataBaseHelper.CIUDAD, ciudad);

      db.insert("tabla", DataBaseHelper.NOMBRE, cv);
      db.close();
    }
  }
Exemplo n.º 3
0
  public void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.deletelist);
    data = new DataBaseHelper(this);
    lv1 = (ListView) findViewById(R.id.List);
    bback = (Button) findViewById(R.id.back);
    bback.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            call();
          }
        });

    Bundle bundle = getIntent().getExtras();
    String name2 = bundle.getString("name1");
    Cursor c1 = data.getDataCallid(name2);
    while (c1.moveToNext()) {
      id1 = c1.getInt(0);
      System.out.println("IDs " + id1);
    }
    Cursor c = data.getDataCallList(id1);
    System.out.println("ID1 " + id1);
    while (c.moveToNext()) {

      n2 = c.getString(0);
      n3 = c.getString(1);
      results.add(n2 + "  " + n3);
      System.out.println("FName" + n2);
      System.out.println("LName" + n3);
      oname = n2 + n3;
    }
    Cursor c2 = data.getCallListid(n2, n3);
    while (c2.moveToNext()) {
      id2 = c2.getInt(0);
      System.out.println("IDs " + id2);
    }
    CheckBox cb = new CheckBox(this);
    lv1.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
    lv1.setAdapter(
        new ArrayAdapter<String>(this, android.R.layout.simple_list_item_multiple_choice, results));
    lv1.setTextFilterEnabled(true);
    lv1.setOnItemClickListener(this);
  }
Exemplo n.º 4
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

    /* First Tab Content */

    Bundle bundle = getIntent().getExtras();
    date1 = bundle.getString("date");
    /*String[]s=date1.split("-");
    day1=s[0];
    mnth=s[1];
    yr=s[2];*/
    System.out.println("date bun" + date1);
    final Calendar c = Calendar.getInstance();
    /*mYear =Integer.parseInt(yr);
    mMonth = getMonthAsNO(mnth);
    mDay = Integer.parseInt(day1);
    date=(+ (mDay) + "-" +(mMonth+1)+ "-" +mYear);*/
    data = new DataBaseHelper(this);
    data.open();
    setContentView(R.layout.gridtask);
    tv = (TextView) findViewById(R.id.txt);
    tv.setVisibility(View.GONE);
    showtask();
    if (results.size() == 0) {
      tv.setVisibility(View.VISIBLE);
      tv.setText("No Tasks!!");
    }
    grid_main = (GridView) findViewById(R.id.GridView01);
    grid_main.setAdapter(new ImageAdapter(this));
    es = (EditText) findViewById(R.id.esearch);
    Window window = getWindow();
    window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
    data.close();
  }
Exemplo n.º 5
0
  /*Type :Function
  name:showtask
  return type:void
  date:10-2-12
  purpose:to get tasks*/
  private void showtask() {
    Cursor c = data.gettaskname1(date1);
    cnt = c.getCount();
    while (c.moveToNext()) {
      id = c.getString(0);
      tname = c.getString(1);

      tdesp = c.getString(2);
      ttime = c.getString(3);
      results4.add(tdesp);
      results.add(tname);
      results2.add(ttime);
      results1.add(tdate);
      results3.add(id);
    }
    c.close();
  }
Exemplo n.º 6
0
 public void onItemClick(AdapterView<?> a, View v, int position, long id) {
   System.out.println("Position..." + position);
   String ans = (String) a.getItemAtPosition(position);
   System.out.println("Value is " + ans);
   s = ans.split(" ");
   System.out.println("Split Value is: " + s[0]);
   System.out.println("Split Value is: " + s[1]);
   lv1.clearChoices();
   data.deletecallist(id2);
   /*AlertDialog.Builder adb=new AlertDialog.Builder(DeleteList.this);
   adb.setTitle("Delete?");
   adb.setMessage("Are you sure you want to delete " + position);
   final int positionToRemove = position;
   adb.setNegativeButton("Cancel", null);
   adb.setPositiveButton("Ok", new AlertDialog.OnClickListener() {
       public void onClick(DialogInterface dialog, int which)
       {
       	data.deletecallist(s[0]);
       	lv1.remove(positionToRemove);
           results.notifyDataSetChanged();
       }});
   adb.show();*/
   Toast.makeText(DeleteList.this, "Contacts Deleted Successfully", Toast.LENGTH_SHORT).show();
 }