Okay, so this is the fastest way to fix your specific problem (as with the smaller changes to get a working snippet), but I will keep track of what should be here.
-, , , , , AsyncTask, null. , , , , BitmapFactory.
:
//Remove this line
//String s="android.resource://"+getApplication().getPackageName()+"/raw/d.jpg/";
this.setContentView(img,
new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
//Remove the "s" from your execute
Myclass=(asynclass) new asynclass().execute();
AsyncTask:
@Override
protected Bitmap doInBackground(String... params) {
Bitmap bmp=null;
bmp=BitmapFactory.decodeResource(MainActivity.this.getResources(), R.raw.d);
return bmp;
}
, .
, , setContentView() , , ImageView , .
xml activity_main.xml, , , :
activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/image_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
onCreate() :
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
img = (ImageView) findViewById(R.id.image_view);
Myclass=(asynclass) new asynclass().execute();
}
.
, !