在程序中切换到下一列有什么用
what is use for switching to next column in programs
/t 用于制表符 /n 用于下一行然后什么用于下一列
public void read(View v) {
Cursor c = dBase.query("employee", null, "id=?", new String[]{ET1.getText().toString()}, null, null, null);
while (c.moveToNext()) {
Toast.makeText(getApplicationContext(),
c.getInt(0) + "\n" +
c.getString(1) + "\n" +
c.getString(2) + "\n" +
c.getString(3),
Toast.LENGTH_LONG).show();
}
ET1.setText("" + c.getInt(0));
ET2.setText("" + c.getString(1));
ET3.setText("" + c.getString(2));
ET4.setText("" + c.getString(3));
Intent i = new Intent(this, AnotherActivity.class);
i.putExtra("1", "");
i.putExtra("2", "");
i.putExtra("3", "");
i.putExtra("4", "");
startActivity(i);
/*write this Code in another activity after SetContentView(); to display data */
Log.e("1", getIntent().getStringExtra("1"));
Log.e("2", getIntent().getStringExtra("2"));
Log.e("3", getIntent().getStringExtra("3"));
Log.e("4", getIntent().getStringExtra("4"));
}
1.Change你读取的return类型class获取其他activity中的数据
2.Make 数据库对象 class 并从该对象读取数据示例
YourDBClass db=new YourDBClass();
String[] 结果=db.read();
/t 用于制表符 /n 用于下一行然后什么用于下一列
public void read(View v) {
Cursor c = dBase.query("employee", null, "id=?", new String[]{ET1.getText().toString()}, null, null, null);
while (c.moveToNext()) {
Toast.makeText(getApplicationContext(),
c.getInt(0) + "\n" +
c.getString(1) + "\n" +
c.getString(2) + "\n" +
c.getString(3),
Toast.LENGTH_LONG).show();
}
ET1.setText("" + c.getInt(0));
ET2.setText("" + c.getString(1));
ET3.setText("" + c.getString(2));
ET4.setText("" + c.getString(3));
Intent i = new Intent(this, AnotherActivity.class);
i.putExtra("1", "");
i.putExtra("2", "");
i.putExtra("3", "");
i.putExtra("4", "");
startActivity(i);
/*write this Code in another activity after SetContentView(); to display data */
Log.e("1", getIntent().getStringExtra("1"));
Log.e("2", getIntent().getStringExtra("2"));
Log.e("3", getIntent().getStringExtra("3"));
Log.e("4", getIntent().getStringExtra("4"));
}
1.Change你读取的return类型class获取其他activity中的数据
2.Make 数据库对象 class 并从该对象读取数据示例 YourDBClass db=new YourDBClass(); String[] 结果=db.read();