在我的应用程序中,我从库中上传图像,我想将此图像存储在SQLite数据库中.如何在数据库中存储位图?我正在将位图转换为字符串并将其保存在数据库中.从数据库中检索它时,我无法将该字符串分配给ImageView,因为它是一个字符串.
Imageupload12 .java:
public class Imageupload12 extends Activity {
Button buttonLoadImage;
ImageView targetImage;
int i = 0;
Database database = new Database(this);
String i1;
String img;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main5);
buttonLoadImage = (Button) findViewById(R.id.loadimage);
targetImage = (ImageView) findViewById(R.id.targetimage);
Bundle b = getIntent().getExtras();
if (b != null) {
img = b.getString("image");
targetImage2.setImageURI("image");
//i am getting error as i cant assign string to imageview.
}
buttonLoadImage.setOnClickListener(new Button.OnClickListener() {
public void onClick(View arg0) {
// TODO Auto-generated method stub …Run Code Online (Sandbox Code Playgroud) 我在一个包含纬度和经度对的文本文件中有一个JSON数据,现在我想将这些数据存储到MYSQL DB中,如何进行以及最好的方法请建议.
这是我的JSON数据
[{"latlon":{"lng":77.75124312,"lat":12.97123123},"type":"s"},
{"latlon":{"lon":77.73004942455374,"lat":12.98227579706589},"type":"s"},
{"latlon":{"lon":77.67374449291539,"lat":12.995490063545521},"type":"v"},
{"latlon":{"lon":77.6097147993144,"lat":12.970900929013666},"type":"s"},
{"latlon":{"lon":77.53933363476645,"lat":12.948316929346504},"type":"s"},
{"latlon":{"lng":77.48213123,"lat":12.91213213},"type":"s"}
.
.
.
.
]
The String may go up to 50 points
Run Code Online (Sandbox Code Playgroud)