How to get text value from string ArrayAdapter in ListView?

I have an app with two activities: 1st - listview with links to html files, second is a webview. For example I press "First Topic" in the listview, it opens "1.html" in the webview. I want to get text value of clicked element in the listview and show it in textview of second activity by this method:

TextView title = (TextView) findViewById(;

Here is a code of ListViewActivity:

public class ListViewActivity extends Activity implements OnClickListener {
    private ListView lv1;
    private String lv_arr[] = { "First Topic", "Second Topic" };

    /** Called when the activity is first created. */
    public void onCreate(Bundle savedInstanceState) {

        lv1 = (ListView) findViewById(;
        lv1.setAdapter(new ArrayAdapter<String>(this, R.layout.list_items,
        lv1.setOnItemClickListener(new OnItemClickListener() {
            public void onItemClick(AdapterView<?> a, View v, int position,
                    long id) {
                String itemname = new Integer(position).toString();
                Intent intent = new Intent();
                intent.setClass(ListViewActivity.this, WebViewActivity.class);

                Bundle b = new Bundle();
                b.putString("defStrID", itemname);


How can I pass the value which was clicked in listview to webviewactivity? Help, please.


change the line

String itemname = new Integer(position).toString();

to this

String itemname = lv_arr[position];

Change your itemname declaration to this.

String itemname = ((TextView) findViewById(;

Need Your Help

Render plaintext using Angular route, ui-view

angularjs angular-ui-router plaintext

I am using Angular 1.3, creating views using ui-router and ui-view.

C# serialPort speed

c# .net performance serial-port

I am developing some monitoring tool for some kind of protocol based on serial communication.