public void startAttendance(View view)
{
Spinner sp=(Spinner) findViewById(R.id.tablepass);
tbl_nm=sp.getSelectedItem().toString();
if(checkForEntries()!=0) {
Cursor c = db.rawQuery("select * from "+ tbl_nm, null);
if(c!=null) {
if (c.moveToFirst())
do {
String n1 = c.getString(c.getColumnIndex("Name"));
String n2 = c.getString(c.getColumnIndex("Branch"));
Intent i = new Intent(this, Attendance.class);
Bundle b = new Bundle();
b.putString("n1", n1);
b.putString("n2", n2);
b.get("n1");
b.get("n2");
i.putExtras(b);
startActivity(i);
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
String attendance = sharedPref.getString("attendance", "default");
ContentValues cv = new ContentValues();
cv.put("attendance", attendance);
db.insertOrThrow(tbl_nm, null, cv);
Toast.makeText(this, "Entered", Toast.LENGTH_SHORT).show();
}while(c.moveToNext());
}
}
}
****出席活动****如何使呼叫活动(prepopup)等待完成被叫活动(出席)任务?
public class Attendance extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_attendance);
Intent i=getIntent();
Bundle b=i.getExtras();
String name=b.getString("n1");
String branch=b.getString("n2");
TextView tv5=(TextView) findViewById(R.id.textView5);
TextView tv6=(TextView) findViewById(R.id.textView6);
tv5.setText(name);
tv6.setText(branch);
}
public void check(View v)
{
SharedPreferences sharedPref;
SharedPreferences.Editor editor;
switch (v.getId())
{
case R.id.button6:
sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
editor = sharedPref.edit();
editor.putString("attendance","present");
editor.commit();
break;
case R.id.button7:
sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
editor = sharedPref.edit();
editor.putString("attendance","absent");
editor.commit();
break;
}
finish();
}
}
prepopup被反复呼吁出席活动并不止一次。信息的 –