I am wanting to create a set of checkboxes dynamically during run time in my android application. When the application runs nothing shows up except the button. What am i forgetting? Thanks in advance!
public class DataNotificationSurvey extends Activity {
private Date timeStamp;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.datanotifylayout);
final Button notifySubmitButton = (Button) findViewById(R.id.notifySubmitButton);
TableLayout t1 = (TableLayout)findViewById(R.id.notificationTableLayout);
for(int i = 0; i < 5; i++) {
TableRow tr = new TableRow(this);
CheckBox chk = new CheckBox(this);
chk.setText(Integer.toString(i));
tr.addView(chk);
t1.addView(tr);
}
notifySubmitButton.setOnClickListener(
new View.OnClickListener() {
#Override
public void onClick(View v) {
finish();
}
});
}
//My xml layout, will be changing this later to the one posted below to see if it works.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:id="#+id/notificationLinearLayout"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TableLayout
android:id="#+id/notificationTableLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button android:text="Static Button"/>
</TableRow>
</TableLayout>
<Button
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="#+id/notifySubmitButton"
android:text="Submit"></Button>
</LinearLayout>
This works fine for me.
public class DynamicTableRowWithCheckBox extends Activity
{
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final Button notifySubmitButton = (Button) findViewById(R.id.myButton);
TableLayout table = (TableLayout) findViewById(R.id.myTable);
for (int i = 0; i < 3; i++)
{
TableRow row = new TableRow(this);
CheckBox chk = new CheckBox(this);
chk.setText(Integer.toString(i));
row.addView(chk);
table.addView(row);
}
notifySubmitButton.setOnClickListener(
new View.OnClickListener()
{
#Override
public void onClick(View v)
{
finish();
}
});
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/hello" />
<Button
android:id="#+id/myButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Close" />
<TableLayout
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:id="#+id/myTable" />
</LinearLayout>
Change your XML to:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:id="#+id/notificationLinearLayout"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TableLayout
android:id="#+id/notificationTableLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TableRow>
<Button
android:text="Static Button" />
</TableRow>
</TableLayout>
<Button
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="#+id/notifySubmitButton"
android:text="Submit"></Button>
</LinearLayout>
This removes the layout_height of your TableLayout to wrap_content, and it removes the height and width settings of your TableRow, because, "The children of a TableRow do not need to specify the layout_width and layout_height attributes in the XML file. TableRow always enforces those values to be respectively MATCH_PARENT and WRAP_CONTENT."
Related
I designed two buttons b1,b2 inside "KeyboardService.java" which should update the value of PACK_LIB inside "Stickers.java".
Three files attached:
main_board_layout.xml
Stickers.java
KeyboardService.java
I assigned both buttons with IDs of Button1 = b1 and Button2 = b2.
The built is successful but when I click on the buttons both do not work.
I think it is maybe a problem with this line ->
final Button button1 = (Button) mainBoard.findViewById(R.id.b1);
Because the Buttons are inside a FrameLayout. But when I use ID of that it won't work either.
Any ideas?
-------main_board_layout.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/main_board"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#color/black"
android:orientation="vertical">
<android.inputmethodservice.KeyboardView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/keyboard_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/black" />
<!--top bar-->
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="#ffffff"/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ffffff"
android:padding="2dp"
android:id="#+id/buttons"
>
<Button
android:id="#+id/b1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/button1" />
<Button
android:id="#+id/b2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="#string/button2"
/>
<TextView
android:id="#+id/packNameLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:text="#string/app_name"
android:textColor="#000000"
android:textSize="1sp"
android:visibility="gone"
/>
<ImageView
android:id="#+id/btShareLinkGP"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:src="#mipmap/bt_share"
tools:srcCompat="#mipmap/bt_share"
/>
</FrameLayout>
<View
android:layout_width="match_parent"
android:layout_height="3dp"
android:background="#000000"/>
<ScrollView
android:id="#+id/gif_view"
android:layout_width="match_parent"
android:layout_height="190dp"
android:background="#color/black"
android:paddingLeft="0dp"
android:paddingRight="15dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/black"
android:gravity="left|center"
android:orientation="horizontal"
android:padding="0dp">
<android.support.v7.widget.RecyclerView
android:id="#+id/pack_recycler_view"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#color/black"
android:orientation="horizontal"
app:layoutManager="android.support.v7.widget.LinearLayoutManager" />
</LinearLayout>
</LinearLayout>
-------Stickers.java
public static String PACK_LIB ="";
public void setDefaultStickerPack() {
checkVersion(true);
InputStream in = null;
String packList[]=new String[0];
final String PACK_APP="pack_app";
final String PACK_ICON="pack_on.png";
String curAssets="";
-------KeyboardService.java
#Override
public View onCreateInputView() {
mainBoard = (LinearLayout) getLayoutInflater().inflate(R.layout.main_board_layout, null);
packNameLabel = (TextView) mainBoard.findViewById(R.id.packNameLabel);
scrollView = (ScrollView) mainBoard.findViewById(R.id.gif_view);
stickerView = (RecyclerView) getLayoutInflater().inflate(R.layout.recycler_view, null);
stickerView.addItemDecoration(new MarginDecoration(this));
stickerView.setHasFixedSize(true);
stickerView.setLayoutManager(new GridLayoutManager(this, 4));
scrollView.addView(stickerView);
ImageView btShareLinkGP = (ImageView) mainBoard.findViewById(R.id.btShareLinkGP);
btShareLinkGP.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
shareLinkToGP();
}
});
// packs bar
packView = (RecyclerView) mainBoard.findViewById(R.id.pack_recycler_view);
// BUTTONS ACTIONS
final Button button1 = (Button) mainBoard.findViewById(R.id.b1);
button1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Stickers.PACK_LIB = "allstickers";
}
});
final Button button2 = (Button) mainBoard.findViewById(R.id.b2);
button2.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Stickers.PACK_LIB = "teststickers";
}
});
showStickers();
return mainBoard;
}
I am having a layout with a single editText in it,below the editText I added a add button. Now my question is when I click the add button I need to get another editText below the editText and has to repeat the same.Please anyone help, Thank you.
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="#+id/ll_edit_texts_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<EditText
android:id="#+id/et1"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<Button
android:id="#+id/buttonAdd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ADD" />
</LinearLayout>
and put following code in your Activity
final LinearLayout llEditTextsContainer = (LinearLayout) view.findViewById(R.id.ll_edit_texts_container);
Button buttonAdd = (Button) view.findViewById(R.id.buttonAdd);
buttonAdd.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
EditText editText = new EditText(getActivity());
//editText.setId(); you should set id smartly if you wanted to use data from this edittext
llEditTextsContainer.addView(editText);
}
});
First of all create a container view in your main layout which is going to hold the new Edittexts.
<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"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context="com.example.vuclip.dynamictextedit.MainActivity">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/addTextView"
android:text="Add EditText"
android:onClick="onClick"
/>
<TableLayout
android:id="#+id/containerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
</TableLayout>
Here, on pressing the button, new Edittexts will be created and added into the TableLayout.
Now create a new Layout which will hold your edittext(I called this file new_layout.xml).
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<EditText
android:id="#+id/newEditText"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
Now add this layout into your main activity.
public class MainActivity extends AppCompatActivity {
TableLayout container;
static int rowIndex = 0;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
container = (TableLayout) findViewById(R.id.containerLayout);
}
public void onClick(View view) {
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View newRowView = inflater.inflate(R.layout.new_layout,null);
container.addView(newRowView,rowIndex);
rowIndex++;
}}
I'm new to Android, and am currently using a ViewFlipper. I'd like to know if it's possible to use only one ImageView? That way I can just create an Arraylist of my images. I think using multiple ImageViews is not a good practice since I have 50+ images.
public void initContent() {
imageArrayList = new ArrayList<Integer>();
imageArrayList.add(R.drawable.pig2);
imageArrayList.add(R.drawable.pig3);
imageArrayList.add(R.drawable.pig4);
imageArrayList.add(R.drawable.pig5);
imageArrayList.add(R.drawable.pig6);
imageArrayList.add(R.drawable.pig7);
imageArrayList.add(R.drawable.pig8);
imageArrayList.add(R.drawable.pig9);
imageArrayList.add(R.drawable.pig10);
imageArrayList.add(R.drawable.pig11);
imageArrayList.add(R.drawable.pig12);
imageArrayList.add(R.drawable.pig13);
imageArrayList.add(R.drawable.pig14);
imageArrayList.add(R.drawable.pig24);
imageArrayList.add(R.drawable.pig25);
imageArrayList.add(R.drawable.theend);
MainActivity.java
public class MainActivity extends Activity {
ViewFlipper viewFlipper;
Button Next;
private Integer images[] = {R.drawable.ic_launcher,
R.drawable.ic_no_image, R.drawable.calendar52};
ImageView imageView1;
private int currImage = 0;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
viewFlipper = (ViewFlipper) findViewById(R.id.ViewFlipper01);
Next = (Button) findViewById(R.id.Next);
imageView1 = (ImageView) findViewById(R.id.imageView1);
Next.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
currImage++;
if (currImage == 3) {
currImage = 0;
}
final ImageView imageView = (ImageView) findViewById(R.id.imageView1);
imageView.setImageResource(images[currImage]);
viewFlipper.showNext();
}
});
}
}
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/LinearLayout01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<RelativeLayout
android:id="#+id/RelativeLayout02"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ViewFlipper
android:id="#+id/ViewFlipper01"
android:layout_width="fill_parent"
android:layout_height="400dp" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#4B0082" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="117dp"
android:src="#drawable/ic_launcher" />
</RelativeLayout>
</ViewFlipper>
</RelativeLayout>
<RelativeLayout
android:id="#+id/RelativeLayout03"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:background="#000000"
android:gravity="center" >
<Button
android:id="#+id/Next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="5dp"
android:layout_marginRight="20dp"
android:text="Next" />
</RelativeLayout>
</LinearLayout>
Yes. Use the frame animation, delete your arraylist. Here is some sample code: Link
What i'm trying to do is add create an application that locates some local business. So the activity I'm doing displays the business information. Some business have severals stores located on the city, and some others only have one. So here is my problem: In the View I have Scroll View with all the elements, and a linear layout inside the scrollview. If the business has more then one store, i will add each store information in a new text view and add the text view to the layout (this is done all by code). But at the moment to display the layout, it only displays me one store, instead of showing me 3 or 4. What I'm I doing wrong? Here is the method setupViews(), which is the one in chanrge of the displaying:
private void setupViews() throws SQLException {
ImageView iv = (ImageView) findViewById(R.id.negocio_logo);
try {
iv.setImageBitmap(BitmapFactory.decodeByteArray(toShow.getImgSrc(),
0, toShow.getImgSrc().length));
} catch (NullPointerException npe) {
iv.setBackgroundColor(Color.WHITE);
}
TextView nombreEmpresa = (TextView) findViewById(R.id.nombre_empresa);
nombreEmpresa.setText(toShow.getNombre());
TextView descripcionEmpresa = (TextView) findViewById(R.id.descripcion_empresa);
descripcionEmpresa.setText(toShow.getDescripcion());
TextView direccionEmpresa = (TextView) findViewById(R.id.direccion_empresa);
direccionEmpresa.setText(toShow.getDireccion());
LinearLayout rl = (LinearLayout) findViewById(R.id.linear_layout_si);
TextView suc = (TextView) findViewById(R.id.sucursales_empresa);
sucursalDAO sDAO = new sucursalDAO();
boolean tieneSucursales = sDAO.hasSucursales(toShow.getId());
if (tieneSucursales == false) {
suc.setVisibility(View.GONE);
// sucs.setVisibility(View.GONE);
} else {
suc.setVisibility(View.VISIBLE);
ArrayList<String> sucursales = sDAO.getStringSucursales(toShow
.getId());
ArrayList<TextView> tvs = new ArrayList<TextView>();
for (int i = 0; i < sucursales.size(); i++) {
TextView tv = new TextView(this);
tv.setText(sucursales.get(i));
tv.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT));
tvs.add(tv);
}
for (int i = 0; i < tvs.size(); i++) {
rl.addView(tvs.get(i), i);
}
}
}
And here is the XML of my view:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/RL"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/White"
android:orientation="vertical" >
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/widgetscroll"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/White"
android:orientation="vertical" >
<ImageView
android:id="#+id/negocio_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:contentDescription="#string/logo_negocio" />
<TextView
android:id="#+id/datos_empresa"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#id/negocio_logo"
android:background="#drawable/barra"
android:text="#string/datos_empresa"
android:textColor="#color/White" />
<TextView
android:id="#+id/nombre_empresa"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#id/datos_empresa"
android:text="#string/testing" />
<TextView
android:id="#+id/descripcion_empresa"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#id/nombre_empresa"
android:text="#string/testing" />
<TextView
android:id="#+id/direccion_empresa"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#id/descripcion_empresa"
android:text="#string/testing" />
<TextView
android:id="#+id/sucursales_empresa"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#id/direccion_empresa"
android:background="#drawable/barra"
android:text="#string/sucursales"
android:visibility="gone" />
<LinearLayout
android:id="#+id/linear_layout_si"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#id/sucursales_empresa" >
</LinearLayout>
<TextView
android:id="#+id/contacto_empresa"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#id/linear_layout_si"
android:text="#string/testing" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>
I think you forgot to set orientation on LinearLayout and it's showing horitzontal
I bet you forgot to set the orientation of the LinearLayout.
Good day everyone,
I'm learning Android development and I try to build some dynamic lists for my application. And I'm stuck... like for 4 hours already.
I have two layouts:
1. main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/action_buttons"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:gravity="center"
>
<Button
android:id="#+id/button_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/button_calculate" />
<Button
android:id="#+id/button_add"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/button_count"
android:text="#string/button_add" />
</LinearLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/action_buttons"
>
<LinearLayout
android:id="#+id/action_list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
</LinearLayout>
</ScrollView>
</RelativeLayout>
action_list_item.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/action_list_item_root"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<EditText
android:id="#+id/action_list_item_edittext_drinkName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/action_list_item_button_remove"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/action_list_item_title"
android:padding="10dp" />
<EditText
android:id="#+id/action_list_item_edittext_drinkPercent"
android:text="40"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toLeftOf="#+id/action_list_item_edittext_drinkAmount"
android:inputType="number"
android:padding="10dp"/>
<EditText
android:id="#+id/action_list_item_edittext_drinkAmount"
android:text="0.0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toLeftOf="#+id/action_list_item_button_remove"
android:layout_alignBottom="#+id/action_list_item_button_remove"
android:inputType="numberDecimal"
android:width="50dp"
android:padding="10dp" />
<Button
android:id="#+id/action_list_item_button_remove"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="#string/action_list_item_button_remove" />
And code that creates dynamic list:
public class MainActivity extends Activity {
LinearLayout actionList = null;
private Button btnAdd;
private Button btnCalculate;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
initActivityElements();
}
private void initActivityElements() {
initAddButton();
initCalculateButton();
}
private void initCalculateButton() {
btnCalculate = (Button) findViewById(R.id.button_count);
btnCalculate.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
TextView amount = (TextView) findViewById(R.id.action_list_item_edittext_drinkAmount);
//this retrives TextView value from first list
Toast.makeText(getApplicationContext(), amount.getText().toString(),
Toast.LENGTH_SHORT)
.show();
}
});
}
private void initAddButton() {
actionList = (LinearLayout) findViewById(R.id.action_list);
btnAdd = (Button) findViewById(R.id.button_add);
btnAdd.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
RelativeLayout listItem = (RelativeLayout) View.inflate(
MainActivity.this, R.layout.action_list_item, null);
TextView name = (TextView) listItem
.findViewById(R.id.action_list_item_edittext_drinkName);
name.setText("Here is the Title " + actionList.getChildCount());
listItem.findViewById(R.id.action_list_item_button_remove)
.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
actionList.removeView((View) v.getParent());
}
});
actionList.addView(listItem);
}
});
}
My problem is that I need to get all data from TextView boxes (Amount, Percent), but I can retrive that data only from first item of a list (look at onClickListener for btnCalculate) and can't figure out how to do it, but tried to add 'unique ids' for view (but that brakes layout, badly), tried setting Tags but again with no luck.
Maybe anyone can give a tip? I bet there is some easy way to do it, but I'm failing to find it and google is no help here.
Thanks
I'm not really sure what exactly you are trying to do but it sounds like you are trying to take in information and populate it into a view. I would recommend having a static text box that takes in your information and builds that into a listview. A good example of how to do that is located here http://developer.android.com/resources/tutorials/notepad/notepad-ex1.html.