0

I have the following code:

String[] citazioni = getResources().getStringArray(R.array.citazioni);
List<String> CitazioniOutput = new ArrayList<String>();
for (String value : citazioni) {
    CitazioniOutput.add(value+"\n<Button android:layout_width=\"wrap_content\" android:layout_height=\"wrap_content\" android:text=\"@string/share\" android:onClick=\"Condividi("+value+")\" />");
}

ArrayAdapter<String> adapter= new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,CitazioniOutput);

ListView listView= (ListView)findViewById(R.id.ListViewCitazioni);
listView.setAdapter(adapter);

I added the text "<Button android:layout ..." to each CitazioniOutput item. I would like to convert this text into an actual Button.

@Raghunandan: yes, I would like to add the share button for every item :)

1
  • 1
    you want a button for each row in listview?? Commented Jan 21, 2014 at 17:45

2 Answers 2

1

You may need to create a custom listview with custom adapter. Use a custom layout for listview item. Add a button in custom layout file. There are plenty of tutorials in web how to do this. Check these links

Custom Listview - Android Hive

Listview - Vogella.com

Sign up to request clarification or add additional context in comments.

Comments

1

You can't translate text values into new views))

If you want to add button into each row, please use custom view: Custom Adapter for List View

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.