Hallo zusammen,
versuche gerade ein externes Bild über die URL in mein app als Hintergrundbild einzufügen und scheitere seit vielen Stunden. 
Java
		
					
			import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import android.app.Activity;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.widget.ImageView;
public class Dashboard extends Activity {
	private ImageView mImageView;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
	
		super.onCreate(savedInstanceState);
		setContentView(R.layout.dashboard);
		mImageView=(ImageView) findViewById(R.id.iv_hintergrund);
	}
	@Override
	protected void onStart() {
		
		super.onStart();
		bildLaden();
	}
	private void bildLaden() {
		String urlString="http://xyonline.de/wp-content/uploads/2010/08/android.gif";
		try {
			mImageView.setImageDrawable(
			Drawable.createFromStream((InputStream)
					new URL(urlString).getContent(), "startseite")		
		);
		} catch (MalformedURLException e) {
		e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
	}
}HTML
		
					
			<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:background="@color/weiss"
  android:orientation="vertical"
  android:padding="10dip">
  <ImageView
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:id="@+id/iv_hintergrund"
  android:layout_weight="1"
  />
  <Button
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:text="test"
  />
  
</LinearLayout>Meine java kenntnisse sind nicht sehr Überragend. Wäre super wenn mir jemand sagen könnte was ich falsch gemacht habe oder wie man es einfacher machen könnte etc.
Vielen Dank im Vorraus,
Stefan
 
		 
		
		
	 
									
		

