以下の Web サービス ベースの Android アプリケーションを開発しています。アプリケーションの出力について言及しました。これが動的テーブル ビューです
final LinearLayout linear = new LinearLayout(
MainActivity.this);
MainLayout.setWeightSum(1.0f);
TableRow row1 = new TableRow(MainActivity.this);
row1.setId(1000 + sCount);
text1 = new TextView(MainActivity.this);
text1.setText(button.getText());
text1.setTextColor(Color.WHITE);
LayoutParams params = new TableRow.LayoutParams(0,
LayoutParams.WRAP_CONTENT, 2f);
text1.setLayoutParams(params);
// text1.setGravity(100);
final Button button = new Button(MainActivity.this);
EditText e = new EditText(MainActivity.this);
LayoutParams params1 = new TableRow.LayoutParams(0,
LayoutParams.WRAP_CONTENT, 0.5f);
e.setLayoutParams(params1);
e.setInputType(InputType.TYPE_CLASS_NUMBER);
arryList.add(text1.getText().toString());
nameArray = arryList.toArray(new String[arryList
.size()]);
String itemname = text1.getText().toString();
button.setText(" X ");
button.setId(2000 + sCount);
LayoutParams params2 = new TableRow.LayoutParams(0,
LayoutParams.WRAP_CONTENT, 0.5f);
button.setLayoutParams(params2);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
MainLayout.removeView(findViewById(v
.getId() - 1000));
}
});
sCount++;
row1.setLayoutParams(new TableRow.LayoutParams(
TableRow.LayoutParams.FILL_PARENT,
TableRow.LayoutParams.WRAP_CONTENT));
row1.setGravity(Gravity.CENTER_VERTICAL);
row1.setPadding(1, 1, 1, 1);
row1.addView(text1);
row1.addView(e);
row1.addView(button);
MainLayout.addView(row1);
}
ll.addView(MainLayout);
// TODO Auto-generated method stub
出力は
textview 値と edittext 値を sharedpreference に保存したい...その後、同じ値を取得して同じテーブル レイアウトをロードしたい...どうすればよいですか?? 助けてください...事前に感謝します..