android将图像放入数据库

时间:2014-07-14 13:48:31

标签: android database image sqlite byte

我想在我的简单数据库中添加一个图像,不知道在下面的代码中添加什么。 图像是一个字节,我想知道要添加到updatecontact列的内容。

 public void run(View view)
{   
  Bundle extras = getIntent().getExtras();
  if(extras !=null)
  {
     int Value = extras.getInt("id");
     if(Value>0){
        if(mydb.updateContact(id_To_Update,name.getText().toString(), phone.getText().toString(), email.getText().toString(), street.getText().toString(), place.getText().toString())){
           Toast.makeText(getApplicationContext(), "Updated", Toast.LENGTH_SHORT).show();   
           Intent intent = new Intent(getApplicationContext(),com.example.addressbook.MainActivity.class);
           startActivity(intent);
         }      
        else{
           Toast.makeText(getApplicationContext(), "not Updated", Toast.LENGTH_SHORT).show();   
        }
     }
     else{
        if(mydb.insertContact(name.getText().toString(), phone.getText().toString(), email.getText().toString(), street.getText().toString(), place.getText().toString())){
           Toast.makeText(getApplicationContext(), "done", Toast.LENGTH_SHORT).show();  
        }       
        else{
           Toast.makeText(getApplicationContext(), "not done", Toast.LENGTH_SHORT).show();  
        }
        Intent intent = new Intent(getApplicationContext(),com.example.addressbook.MainActivity.class);
        startActivity(intent);
        }
  }
}

0 个答案:

没有答案