我想将此活动转换为Fragment,我该怎么做? 你能告诉我怎么样吗?需要帮助。谢谢! 这是我的代码。 我想将此活动转换为Fragment,我该怎么做? 你能告诉我怎么样吗?需要帮助。谢谢! 这是我的代码。 我想将此活动转换为Fragment,我该怎么做? 你能告诉我怎么样吗?需要帮助。谢谢! 这是我的代码。
import java.io.IOException;
import android.app.Activity;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.widget.TextView;
public class Commbody extends Activity {
TextView cmd,desc,cmddesc,syntax,options;
int id;
DBHelper dbhelper;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.desc);
id = getIntent().getIntExtra("COMMAND_ID", 0);
SQLiteDatabase db = (new DBHelper(this)).getWritableDatabase();
Cursor cursor = db.rawQuery("SELECT linux_comm._id, linux_comm.comm_desc, linux_comm.syntax, linux_comm.options FROM linux_comm WHERE linux_comm._id = ?",
new String[]{""+id});
if (cursor.getCount() == 1)
{
cursor.moveToFirst();
cmddesc = (TextView) findViewById (R.id.TextView4);
cmddesc.setText(cursor.getString(cursor.getColumnIndex("comm_desc")));
syntax = (TextView) findViewById (R.id.TextView5);
syntax.setText(cursor.getString(cursor.getColumnIndex("syntax")));
options = (TextView) findViewById (R.id.TextView6);
options.setText(cursor.getString(cursor.getColumnIndex("options")));
}
}
}
感谢您的帮助。
答案 0 :(得分:1)