システムSMSアプリケーションをデータベースから取得したSMS本体で開こうとしています。Android 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);
}
});
コンテンツの文字列を参照するための任意の方法は?