음식점 정보를 나타내주는 소스인데요ㅜㅜ
소스자체에는 오류가 없다고 하고 에뮬레이터에 띄우면 오류가 떠요
디비가 잘못된거같은데 뭘더 추가해야하는지 아니면 뭘 더 수정해야되는지 하나도 모르겠어요ㅜ
package app.TodayMealApp;
import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;
import com.google.android.maps.MapView;
public class restaurant extends Activity{
String name_str;
DatabaseHelper myDbHelper= new DatabaseHelper(this);
SQLiteDatabase db1 = myDbHelper.getReadableDatabase();
public restaurant(String Name){
name_str=Name;
}
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.restau);
name_str="왕비집";
String sql1="SELECT Address, Tel, Favorite, Latitude, Longitude FROM TodayMeal WHERE Name = '왕비집';";
final String sql2="UPDATE TodayMeal " +" SET Favorite = 1 WHERE Name = '" +name_str+ "';";
final String sql3="UPDATE TodayMeal " +" SET Favorite = 0 WHERE Name = '" +name_str+ "';";
Cursor cursor1=db1.rawQuery(sql1, null);
String add_str=cursor1.getString(0);
String call_str=cursor1.getString(1);
// final int favor_int=cursor1.getInt(2);
// final String favor_str=cursor1.getString(2);
// double longi_dou=cursor1.getDouble(3);
// double lati_dou=cursor1.getDouble(4);
String lat=cursor1.getString(3);
String lon=cursor1.getString(4);
// int favor=0;
TextView name=(TextView)findViewById(R.id.textView5);
name.setText(name_str);
TextView addr=(TextView)findViewById(R.id.textView6);
addr.setText(add_str);
Button callButton=(Button)findViewById(R.id.button3);
callButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
startActivity(new Intent("android.intent.action.CALL", Uri.parse("tel:"+"Integer.parseInt(call_str)")));
}
});
/*
Button favorButton=(Button)findViewById(R.id.button4);
favorButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
// favorite->1로변경
// favor=Integer.parseInt(favor_str);
if(Integer.parseInt(favor_str)==0){
db1.rawQuery(sql2,null);
}else{
db1.rawQuery(sql3,null);
}
}
});*/
db1.close();
/*
GoogleMap gm=new GoogleMap(Double.parseDouble(lat), Double.parseDouble(lon));
gm.myMap=(MapView)findViewById(R.id.map_view);
*/
ImageButton homeButton = (ImageButton)findViewById(R.id.homeButton);
homeButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent = new Intent(restaurant.this, TodayMealActivity.class);
startActivity(intent);
}
});
}
}




누가 알까요...로그켓이라도 쫌...