我需要设置验证,用户必须填写/选择页面中的所有详细信息.如果任何字段是空的想显示Toast message to fill.
现在我需要设置验证RadioButton
在RadioGroup.
我尝试此代码但但无法正常工作.建议我正确的方法.谢谢.
// get selected radio button from radioGroup
int selectedId = gender.getCheckedRadioButtonId();
// find the radiobutton by returned id
selectedRadioButton = (RadioButton)findViewById(selectedId);
// do what you want with radioButtonText (save it to database in your case)
radioButtonText = selectedRadioButton.getText().toString();
if(radioButtonText.matches(""))
{
Toast.makeText(getApplicationContext(), "Please select Gender", Toast.LENGTH_SHORT).show();
Log.d("QAOD", "Gender is Null");
}
else
{
Log.d("QAOD", "Gender is Selected");
}
Run Code Online (Sandbox Code Playgroud) 我从这个网站Developer.Android下载并安装了带有Android SDK for Eclipse的Eclipse ADT .当我尝试创建AVD设备时出现错误,Location of Android SDK has not been setup in Preferences.
我Preferences
从Windows
菜单栏打开然后我尝试设置SDK位置,但它显示错误此Android SDK需要ADT版本23.0.0或更高版本.当前版本是22.6.请将ADT更新到最新版本.如何更新?帮我创建android项目.
我想通过待处理意图重新启动我的应用程序。下面的代码不起作用。
val intent = Intent(this, Activity::class.java).apply {
flags = Intent.FLAG_ACTIVITY_CLEAR_TOP
}
val pendingIntentId = 1
val pendingIntent = PendingIntent.getActivity(this, pendingIntentId, intent, PendingIntent.FLAG_CANCEL_CURRENT)
val mgr = getSystemService(Context.ALARM_SERVICE) as AlarmManager
val timeToStart = System.currentTimeMillis() + 1000L
mgr.set(AlarmManager.RTC, timeToStart, pendingIntent)
exitProcess(0)
Run Code Online (Sandbox Code Playgroud)
目标版本是 31,因此更新了未决意图,但PendingIntent.FLAG_MUTABLE
仍然不起作用。我搜索了许多与此相关的链接,但没有运气。
2022 年 11 月,当目标版本为 31 且最低 sdk 版本为 29 时,上述待处理意图代码不会重新启动应用程序。
除了重新启动活动之外,还有为什么上述未决意图不起作用的任何线索或任何其他建议吗?我不想使用重新启动startActivity(intent)
在Dreamweaver CC中使用Phone-gap开发Android应用程序的新手.我设计了简单的表单,有4个字段,我需要在sqlite数据库中存储这些字段?在eclipse中导入sqlite数据库并打开数据库连接然后创建表和存储数据.这工作正常,我需要在Dreamweaver CC中做同样的事情吗?
import android.database.sqlite.SQLiteDatabase;
SQLiteDatabase db;
db = this.openOrCreateDatabase("QAOD", MODE_PRIVATE, null);
db.execSQL("INSERT INTO TableName(Id) VALUES(18)");
Run Code Online (Sandbox Code Playgroud)
这个格式代码在eclipse android中工作正常,但是我需要使用这个代码并将数据存储在带有Phone-gap的Dreamweaver CC中的sqlite中.帮帮我或建议我存储数据.
我试图将数据源绑定到DevExpress.XtraEditors.LookupEdit
运行时.我试过这段代码,但收到以下错误:
这会导致集合中的两个绑定绑定到同一属性.参数名称:绑定.
这是我的代码:
// Create an adapter to load data from the "Customers" table.
OleDbDataAdapter testcustomers = new OleDbDataAdapter(
"SELECT CustomerId, Customername FROM Customer WHERE CompanyId =" + TXE_CompId.Text, connection);
DataSet ds = new DataSet(); // Create a dataset that will provide data from the database.
testcustomers.Fill(ds, "Customer"); // Load data from the "Customers" table to the dataset.
// A BindingSource for the "Customers" table.
BindingSource binding_cust = new BindingSource(ds, "Customer");
CBL_SelectCustomer.DataBindings.Add("EditValue", binding_cust, "CustomerId"); // getting error on …
Run Code Online (Sandbox Code Playgroud) 在我的发票表格中textEdit1
,它"INV001"
最初是在第一次显示.然后我们将Invoice表单详细信息存储到MS Access数据库.下次on-wards会textEdit1
自动想要显示下一个发票号码"INV002"
.怎么做?
如果它只是数字我尝试这个代码工作成功,但现在我也有3个字母,所以如何执行此操作?
OleDbConnection con =
new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:/Srihari/Srihari/Invoice.accdb");
con.Open();
OleDbCommand cmd =
new OleDbCommand(
"SELECT * FROM NewInvoice_1 WHERE InvoiceNumber = (select max(InvoiceNumber) from NewInvoice_1)",
con);
OleDbDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
int a = reader.GetInt32(1);
TXE_Invoice_Number.Text = (1 + a).ToString();
}
Run Code Online (Sandbox Code Playgroud) 我可以从 Db 将值设置为有界列。
使用此代码
int c = a + b;
Run Code Online (Sandbox Code Playgroud)
gridView1.SetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns["boundcolumn"], c);
但我想将此 c 值设置为未绑定列。此代码不适用于未绑定列。如何将值设置为 Unbound Coulmn ?
您好我的查询得到此错误有助于我恢复它
SELECT CompanyId, CompanyName, RegistrationNumber,
(select CompanyAddress from RPT_Company_Address where
RPT_Company_Address.CompanyId=Company.CompanyId) AS CompanyAddress,
MobileNumber, FaxNumber, CompanyEmail, CompanyWebsite, VatTinNumber
FROM Company;`
Run Code Online (Sandbox Code Playgroud) 在我简单的Android应用程序中显示当前日期05-08-2014.使用此代码
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
String currentDate = sdf.format(new Date());
datepick.setText(currentDate);
Run Code Online (Sandbox Code Playgroud)
当用户想要更改日期时,我将DatePicker用于该textview(datepick).使用此代码
//To show current date in the datepicker
Calendar mcurrentDate=Calendar.getInstance();
int mYear = mcurrentDate.get(Calendar.YEAR);
int mMonth = mcurrentDate.get(Calendar.MONTH);
int mDay = mcurrentDate.get(Calendar.DAY_OF_MONTH);
DatePickerDialog dpdialog=new DatePickerDialog(QAOD_Tab_1.this, new OnDateSetListener(){
@Override
public void onDateSet(DatePicker view, int selectedyear, int selectedmonth, int selectedday) {
datepick.setText(new StringBuilder()
.append(selectedday).append("-").append(selectedmonth + 1).append("-")
.append(selectedyear).append(" "));
}
}, mYear, mMonth, mDay);
dpdialog.setTitle("Select Date");
dpdialog.show(); `
Run Code Online (Sandbox Code Playgroud)
现在我得到这样的日期5-8-2014.我还需要在日期和月份之前显示零.如何以这种格式显示零.我需要像这样的结果05-08-2014.
我从DateEdit获取日期并尝试存储到Access数据库.但它显示这样的错误
Syntax error in INSERT INTO statement.
我的插入语句是这样的
OleDbCommand top = new OleDbCommand("INSERT INTO invoice(invoice_number,order_number,customername,status,subtotal,tax,total,date) VALUES (" + inno + "," + odrno + ",'" + name + "','"+ chk1 +"' ,"+ subtottal +","+ tax +","+total+",'"+date+"')", conn);
top.ExecuteNonQuery();
Run Code Online (Sandbox Code Playgroud)
除了日期剩余值存储成功但我如何存储日期?
我得到这样的约会 DateTime date = dateEdit1.DateTime;
帮我.
android ×5
c# ×4
winforms ×4
ms-access ×3
devexpress ×2
alarmmanager ×1
cordova ×1
datepicker ×1
dreamweaver ×1
eclipse ×1
gridview ×1
radio-button ×1
radio-group ×1
sdk ×1
sql ×1
sqlite ×1