データベースから取得したSMS本体を使用してシステムSMSアプリケーションを開こうとしています。
Cursor
データベースからタイトルとメッセージを取得するために使用していSQLite
ます。smsButton
クリックされるものがあります。クリックすると、SMSインテントが作成されます。
私の問題はメッセージの本文にあります。本体をデータベースから取得したmsg_contentにします。私はそれを参照しようとしましたが、失敗したと思います。
これが私の最後の試みであり、msg_contentレイアウトのIDを取得するTextViewを作成しようとしています。
//First: DataBase Retrieving :
//fetch a msg from table `t` with id `id`
Cursor cursor = myDbHelper.fetchMessage(t, id);
String[] columns = {cursor.getColumnName(1), cursor.getColumnName(2)};
int[] columnsLayouts = {R.id.title, R.id.msg_content}; //the columns styles
ca = new SimpleCursorAdapter(this.getBaseContext(), R.layout.msg_items_layout, cursor,columns , columnsLayouts);
lv = (ListView) findViewById(android.R.id.list);
lv.setAdapter(ca);
//Here is MY PROBLEM :
TextView msgText = (TextView) findViewById(R.id.msg_content); //same Id as the msg_content column above
smsButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
String uri= "smsto:";
Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse(uri));
intent.putExtra("sms_body", msgText.getText());
intent.putExtra("compose_mode", true);
startActivity(intent);
}
});
コンテンツの文字列を参照する方法はありますか?