For this, I fetched all data in a activity which is stored in sqlite. Now all data should be converted into pdf form and automatically should be attach on email. When I press share button. Please give me your valuable suggestions, links or complete source code if any one have.
public class ListofShopping extends Activity {
TextView cat, prd, iName, iBrand, iAge, iColor, iQnty, iCst, iDsc;
Button discard, share;
String s1, s2, s3, s4, s5, s6, s7, s8, s9, a1, a2;
SQLiteDatabase db;
Cursor c;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.listofshop);
cat = (TextView) findViewById(R.id.eCat);
prd = (TextView) findViewById(R.id.ePrdct);
iName = (TextView) findViewById(R.id.eItem);
iBrand = (TextView) findViewById(R.id.eBrand);
iAge = (TextView) findViewById(R.id.eAge);
iColor = (TextView) findViewById(R.id.eClr);
iQnty = (TextView) findViewById(R.id.eQnty);
iCst = (TextView) findViewById(R.id.eCost);
iDsc = (TextView) findViewById(R.id.eDsc);
discard = (Button) findViewById(R.id.dscrd);
share = (Button) findViewById(R.id.email);
db = openOrCreateDatabase("Shopping.db", MODE_PRIVATE, null);
c = db.rawQuery("select * from SHOPPING_LIST", null);
if(c.getCount()==0){
}
while(c.moveToNext()){
s1= c.getString(0);
s2= c.getString(1);
s3= c.getString(2);
s4= c.getString(3);
s5= c.getString(4);
s6= c.getString(5);
s7= c.getString(6);
s8= c.getString(7);
s9= c.getString(8);
s10=c.getString(9);
s11=c.getString(10);
}
c.close();
db.close();
cat.setText(s1);
prd.setText(s2);
iName.setText(s3);
iBrand.setText(s4);
iAge.setText(s5);
iColor.setText(s6);
iQnty.setText(s7);
iCst.setText(s8);
iDsc.setText(s9);
}
}