Html.ImageGetter TextView
Więc używam ImageGetter do wyświetlania obrazów z postów na blogu JSON. Dostaję poprawne źródło w dzienniku, ale adres URL zmienia się, gdy osiągnie setBounds. Jakieś pomysły?
Kod:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_blog_view);
Intent intent = getIntent();
Uri blogUri = intent.getData();
mPost = blogUri.toString();
mUrl = getIntent().getStringExtra("mUrl");
TextView textView = (TextView) findViewById(R.id.scrollView1);
textView.setText(Html.fromHtml(mPost, imgGetter, null));
}
private ImageGetter imgGetter = new ImageGetter(){
@Override
public Drawable getDrawable(String source){
Drawable drawable = Drawable.createFromPath(source);
try {
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
}catch (NullPointerException e){
logException(e);
}
return drawable;
}
};
„Źródło” przed próbą
http://www.domain.com/images_blog/feature.png
ale w połowu błąd jest:
Nie można zdekodować strumienia:
java.io.FileNotFoundException: /http:/www.domain.com/images_blog/feature.png : open failed: ENOENT (No such file or directory)