main Android main ek application develop kar raha ho lakin mujhe ik problem face karne parh rahi hai wo ye hai ke jub main 2-d array use karta ho tho emulator main result sahi nai ata. ye mera code hai.
Code:
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
GridView lv = (GridView) findViewById(R.id.mylistview);
String s[][]=new String[2][2];
/*String s[][] = new String[8][8];
for(int i=0;i<=7;i++)
for(int j = 0; j <= 7; j++){
s[i][j]="9";
}*/
for(int y = 0; y<=1;y++)
for(int u = 0;u<=1;u++)
s[y][u]="w";
ArrayAdapter a = new ArrayAdapter(this, R.layout.rowlb, R.id.textview1,
s);
lv.setAdapter(a);
}
}
Bookmarks