package com.book.minipangkakao;
import android.app.*;
import android.content.Intent;
import android.database.*;
import android.os.Bundle;
import android.util.*;
import android.view.*;
import android.view.View.*;
import android.widget.*;
public class TestInput extends Activity implements OnClickListener{
DBHandler dbHandler;
EditText edtName;
Cursor cursor = null;
String[] arr = null;
TextView tvi;
MainView mainview;
int s = 0;
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.testrank);
Button btn = (Button)findViewById(R.id.button1);
btn.setOnClickListener(this);
s = MainView.score;
s *=100;
edtName = (EditText)findViewById(R.id.editText1);
TextView tvi = (TextView)findViewById(R.id.textView3);
tvi.setText(" "+s);
}
public void onClick(View v){
dbHandler = DBHandler.open(this);
try {
long re = dbHandler.insert(
edtName.getText().toString(),
tvi.getText().toString());
if(re == 0){
Toast.makeText(this, "추가 실패", 2000).show();
}else{
Toast.makeText(this, "추가 성공", 2000).show();
cursor = dbHandler.selectAll();
arr = new String[cursor.getCount()];
int count = 0;
while(cursor.moveToNext()){
String code = cursor.getString(0);
String sang = cursor.getString(1);
String price = cursor.getString(2);
arr[count] = code + " " + sang + " " + price;
count++;
}
cursor.close();
}
} catch (Exception e) {
Log.i("disp", "err:" + e);
}
Intent intent2 = new Intent(TestInput.this, ListTest.class);
startActivity(intent2);
}
}
s값을 DB핸들러로 넘기고 싶은데 작동은 하지만 안넘어가네요... 방법이 없을까요?? 에디트 텍스트껀 잘 넘어가는데..
이거때문에 하루종일 골머리썩고있네요 ㅠ