0
我必須意圖通過點擊一個按鈕,其中整個佈局是以編程方式創建的。 我檢查了'Android content activity not found exception'的所有答案,並嘗試了所有答案。但問題仍然存在。我使用了try catch塊,但問題仍然存在。Android將意圖從onclick按鈕創建編程 - 未找到活動例外
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
db = new DBOperation(this);
document = getIntent().getStringExtra("document_id");
getAlldataList=db.getPartiesReport(db);
LinearLayout rootView = new LinearLayout(this);
LinearLayout rootView1 = new LinearLayout(this);
// RelativeLayout rootView2 = new RelativeLayout(this);
Button update1 = new Button(this);
update1.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
update1.setGravity(Gravity.CENTER);
update1.setText("UPDATE");
update1.setBackgroundColor(Color.parseColor("#ffa500"));
update1.setTextColor(Color.WHITE);
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) update1.getLayoutParams();
params.setMargins(20, 20, 20, 10);
update1.setLayoutParams(params);
update1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
for (int i = 0; i < poslist.size(); i++) {
//
// SQLiteDatabase base3 = db.getWritableDatabase();
// base3.delete(UPDATEPARTIES1, null, null);
// System.out.println("Parties DB Deleted");
SQLiteDatabase db7 = db.getWritableDatabase();
ContentValues values5= new ContentValues();
values5.put(DBManager.TableInfo.KEYID, ID1);
values5.put(DBManager.TableInfo.DOCUMENT, document);
values5.put(DBManager.TableInfo.ATTENDANCE,attendancelist.get(i));
values5.put(DBManager.TableInfo.EMAILNEW, emaillist.get(i));
values5.put(DBManager.TableInfo.PARTYTYPE,partytypelist.get(i));
values5.put(DBManager.TableInfo.BIOMETRIC,biometriclist.get(i));
values5.put(DBManager.TableInfo.KEY_LOGIN_USER,username2);
String condition5 = DBManager.TableInfo.DOCUMENT + " =?";
Cursor cursor5 = db7.query(DBManager.TableInfo.UPDATEPARTIES1, null, condition5, new String[]{DBManager.TableInfo.ATTENDANCE}, null, null, null);
long status5 = db7.insert(DBManager.TableInfo.UPDATEPARTIES1, null, values5);
System.out.println("Parties insert : " + status5);
cursor5.close();
db7.close();
}
itemlist.clear();
poslist.clear();
IDlist.clear();
attendancelist.clear();
partytypelist.clear();
emaillist.clear();
biometriclist.clear();
System.out.println("Poslist:" + poslist.size());
System.out.println("itemlist:" + itemlist.size());
System.out.println("IDlist:" + IDlist.size());
Intent i1=new Intent(anulom.executioner5.com3.anulom.newstatusinfo.this,SendPartyReport.class);
startActivity(i1);
finish();
}
});
清單中的活動「SendPartyReport」? – RobVoisey
有你在申報清單文件 – Anil
是本次活動的 –
user7245