package zc.gdzj.ztext;
import zc.gdzj.ztextsqlite.*;
import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.text.method.ScrollingMovementMethod;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class showActivity extends Activity {
private EditText searchEditText;
private Button sureButton;
private TextView showTextView;
private int i=0;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.list_activity);
DBAdapter db = new DBAdapter(this);
sureButton=(Button)findViewById(R.id.sureButton);
searchEditText=(EditText)findViewById(R.id.findEditText);
showTextView=(TextView)findViewById(R.id.showTextview);
showTextView.setMovementMethod(ScrollingMovementMethod.getInstance());
db.open();
Cursor c = db.getAllTitles();
if (c.moveToFirst())
{
do {
DisplayTitle(c,i);
i++;
} while (c.moveToNext());
}
db.close();
sureButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent=new Intent();
intent.putExtra("id", searchEditText.getText().toString());
intent.setClass(showActivity.this, singleActicity.class);
startActivity(intent);
}
});
}
public void DisplayTitle(Cursor c,int i)
{
showTextView.append(c.getString(0)+":TITLE: " +c.getString(1)+ "\n" +c.getString(2)+"\n");
}
}
求問這段程序中Intent 使用問題所在。這是第二個界面不是第一個。第二個Activity 跳轉到第三個的時候直接歇火了。
我解決了,是因為我在注冊文件中寫錯了一個字母。這個傳輸沒有問題。謝謝