我正在创建一个 android 应用程序,在该应用程序中我使用一种表格进行查询。
单击查询按钮时,应用程序必须显示一个表单。在用户按下提交按钮时完成表单输入用户后,数据应保存在数据库中,表单详细信息必须通过邮件发送到管理员帐户。
我在谷歌搜索,但我没有得到我想要的确切信息。
这是我的代码
订单.java
package com.example.shaktitool;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class Order extends Activity{
private SQLiteAdapterOrder mySQLiteAdapter;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.order);
mySQLiteAdapter = new SQLiteAdapterOrder(this);
mySQLiteAdapter.openToWrite();
mySQLiteAdapter.deleteAll();
final MY_TABLE tb = new MY_TABLE(this);
final EditText name = (EditText)findViewById(R.id.username);
final EditText mail = (EditText)findViewById(R.id.email);
final EditText phone = (EditText)findViewById(R.id.phone);
final EditText product = (EditText)findViewById(R.id.product);
final String _name = name.getText().toString();
final String _mail = mail.getText().toString();
final String _phone = phone.getText().toString();
final String _product = product.getText().toString();
System.out.println(_name);
System.out.println(_mail);
System.out.println(_phone);
System.out.println(_product);
Button email = (Button) findViewById(R.id.Button01);
email.setOnClickListener(new View.OnClickListener(){
public void onClick(View v) {
// TODO Auto-generated method stub
tb.open();
final String _name = name.getText().toString();
final String _mail = mail.getText().toString();
final String _phone = phone.getText().toString();
final String _product = product.getText().toString();
System.out.println(name);
Toast.makeText(getBaseContext(), "Record Saved",Toast.LENGTH_LONG).show();
System.out.println(mail);
System.out.println(phone);
System.out.println(product);
tb.createorders(name, mail, phone, product);
tb.delete("12");
tb.close();
}
});
}
}
谁能帮我...