小编use*_*266的帖子

如何在SQLite数据库中存储图像

在我的应用程序中,我从库中上传图像,我想将此图像存储在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)

sqlite android android-emulator

71
推荐指数
4
解决办法
25万
查看次数

如何在android中上传图库

我想将手机库中的图像上传到我的应用程序中.在我的应用程序中有一个名为upload的按钮.当我点击按钮,它应该移动到画廊和画廊,如果我选择图像,所选图像应该在应用程序中显示为缩略图.我想从我的应用程序中的库中上传10个图像.

android android-layout

15
推荐指数
3
解决办法
6万
查看次数

如何在jsonparsing中的android中的url中用%20替换空格

在我的应用程序中,我想用我的字符串中的%20替换空格.我试过这样,

String flag1="http://74.208.194.142/admin/upload_image/1342594079_images (2).jpg";
flag1.replaceAll("", "%20");
Run Code Online (Sandbox Code Playgroud)

但它不起作用请帮助我.我得到空指针异常.

java

7
推荐指数
2
解决办法
2万
查看次数

是否可以从android中的位图中删除透明像素

在我的应用程序中我拍摄截图,如果图像没有填充imageView然后透明像素被添加到位图.是否可以从位图中删除透明像素或截取没有透明像素的截图.谢谢提前.

android bitmap

7
推荐指数
2
解决办法
3595
查看次数

如何在android中旋转按钮

嗨,在我的应用程序中,我试图旋转按钮关于它的中心但它不是基于它的中心旋转而不是它从它的位置移动.下面是我的代码请帮助我如何解决这个问题.

 public class example extends Activity {
float newAngle,oldAngle=0;


int flag=0;
int n=340;
 RotateAnimation animation,animation1;

    Button arrow;
    Button left,right;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
     arrow=(Button)findViewById(R.id.img);
     left=(Button)findViewById(R.id.left);
     right=(Button)findViewById(R.id.right);
    final int width = arrow.getWidth();
    final int height = arrow.getHeight();      

     left.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            if(flag>=0)
            {
                   newAngle = oldAngle+ 30;

                    oldAngle=newAngle;
            }
            flag++;
            Log.i("flag",""+flag);
             animation = new RotateAnimation(oldAngle, newAngle);
             animation.setFillAfter(true);
             animation.setDuration(200); …
Run Code Online (Sandbox Code Playgroud)

android android-orientation

2
推荐指数
1
解决办法
2878
查看次数

android.os.NetworkOnMainThreadException

在我的应用程序中得到android.os.NetworkOnMainThreadException.我正试图从网址获取图像,当时我得到了这个Exception.如果我在2.2中运行应用程序它工作正常,但如果我在4.0上运行获得异常.

public static Bitmap getBitmap(String url)
{
    Bitmap bitmap = null;

    try
    {
        // replace space with url encoded character.
        url = url.replace(" ", "%20");
        // System.out.println("url : " + url);
        URL urll = new URL(url);
        InputStream in = (InputStream) urll.getContent();
        bitmap = BitmapFactory.decodeStream(in);
    }
    catch ( MalformedURLException e )
    {
        e.printStackTrace();
    }
    catch ( IOException e )
    {
        e.printStackTrace();
    }

    if ( bitmap == null )
        bitmap = BitmapFactory.decodeResource(resources, R.drawable.noimage);

    return bitmap;
}
Run Code Online (Sandbox Code Playgroud)

我收到了错误

  InputStream …
Run Code Online (Sandbox Code Playgroud)

android android-widget android-image networkonmainthread

2
推荐指数
1
解决办法
9109
查看次数