title: Show image on screen from ftp server
body: <p>I almost build my android application, but i have some troubles. My app use a ftp connection to upload photos on a server and display on screen this photos. With "upload part" i have no problems, but when i choose a photo and i want to display it on screen, I encounter some problems. Seems like my image is blurred or fragmented. I think that is from redimensioning, but in this way i tried many algorithms ...unsuccessful
  Please tell me how can I display on screen an image from this ftp server, image displayed at good quality without "blurred or fragmented" part, thank you </p>
  
  <p>This is my "show image" class...</p>
  
  <pre><code>import java.io.BufferedInputStream;
  import java.io.File;
  import java.io.IOException;
  import java.io.InputStream;
  
  import android.annotation.SuppressLint;
  import android.app.Activity;
  import android.graphics.Bitmap;
  import android.graphics.BitmapFactory;
  import android.os.Bundle;
  import android.util.Log;
  import android.widget.ImageView;
  
  @SuppressLint("NewApi")
  public class FaceDetection extends Activity {
  public String o;
  public ImageView viu;
  public Bitmap bit;
  public Bitmap myBitmap;
  File file;
    InputStream a=null;
  
   @Override
   public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.poza);
    a=NextActivity.aa;
    viu=(ImageView)findViewById(R.id.imageView1);
    o=getIntent().getStringExtra("CaleOptiune");
              setData(o);
              initData();
            bit=getBit();
            viu.setImageBitmap(bit);
  
        }
  
  
   public Bitmap getBit(){          
         BitmapFactory.Options BitmapFactoryOptionsbfo = new BitmapFactory.Options();
         BitmapFactoryOptionsbfo.inPreferredConfig = Bitmap.Config.RGB_565;
         myBitmap = BitmapFactory.decodeResource(getResources(),
           R.drawable.index, BitmapFactoryOptionsbfo);
         if(a!=null){Log.e("asdasdsadsadas","Streamul este incarcat");}else{Log.e("asdasdsadsadas","E nullllllll");}
         myBitmap = BitmapFactory.decodeStream(new BufferedInputStream(a));
         return myBitmap;
   }
  
  
  
   public void initData(){
  
         File file=new File(o);
         try {
          Log.e("Fisierul curent este",""+Logare.ftpClient.getWorkingDirectory());
      } catch (IOException e2) {
          // TODO Auto-generated catch block
          e2.printStackTrace();
      }
         Log.e("File","Fisier creat din calea "+o);
         Log.e("File name",""+file.getName());
      try {
          a = Logare.ftpClient.ftpClient.retrieveFileStream(file.getName());
          Logare.ftpClient.ftpClient.completePendingCommand();
      } catch (Exception e1) {
          Log.e("asdasdsadsadas","Nu s-a instantiat InputSteamul");
      }
  
    }
  
  
   public void setData(String o) {
      this.o = o;
  
   }
  </code></pre>
  
  <p>}</p>