i attempting create multiple copies of single image. while debugging, seems fine until try stepping past line imageview image = ...
-- program stops , gives me source not found error (tab title: activitythread.performlaunchactivity(activitythread$activityclientrecord, intent) line: 1953).
frustrated this... can tell me why happens???
main.java
package languid.legend.test; import android.app.activity; import android.content.context; import android.os.bundle; import android.view.layoutinflater; import android.view.view; import android.widget.imageview; import android.widget.relativelayout; /** * @author adam * */ public class main extends activity { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); relativelayout layout = (relativelayout) findviewbyid(r.layout.activity_main); relativelayout.layoutparams params = new relativelayout.layoutparams(-1, 345); layoutinflater inflater = (layoutinflater) this.getsystemservice(context.layout_inflater_service); // getting access laytou inflater view[] tiles = new imageview[9]; (int = 0; < tiles.length; i++) { // creating copy of imageview inflating imageview image = (imageview) inflater.inflate(r.layout.singleimage, null); tiles[i] = image; tiles[i].setid(100+i); params.leftmargin = 32 * 2 * i; params.topmargin = 34 * 2 * i; layout.addview(tiles[i]); } } }
activity_main.xml
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > </relativelayout>
singleimage.xml
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <imageview android:layout_width="match_parent" android:src="@drawable/ic_launcher" android:contentdescription="sample" android:id="@+id/image2" android:layout_height="match_parent" /> </relativelayout>
Comments
Post a Comment