I have to put intent to a service from on click of a button, where the whole layout is created programmatically. I have checked all answers for 'Android content activity not found exception' and have tried all answers. But still the problem persists. I have used try catch block, still the problem exists.
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();
}
});