Clickable text in android
<p>I have a database that has three columns Maker, Model and Price and I have made it so that when a button is pressed to store everything in a string and pass the string to a TextView. The idea is that I want to somehow make the text clickable and when the text is clicked for a given product to store the price of the product in a variable.</p>

<p>This is the code for displaying everything in the database</p>

<pre><code>    package com.WareHouse;

import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class viewall extends Activity {

SQLiteDatabase myDB = null;

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.vall);

    Button vAll = (Button) findViewById(R.id.viewAll);
    final TextView view2 = (TextView) findViewById(R.id.multiAutoCompleteTextView1);

    vAll.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {

            try {
                String Data = "";

                String TableName = "myTable";

                myDB = getBaseContext().openOrCreateDatabase(
                        "DatabaseName", MODE_PRIVATE, null);

                Cursor c = myDB
                        .rawQuery("SELECT * FROM " + TableName, null);

                int Column1 = c.getColumnIndex("Field1");
                int Column2 = c.getColumnIndex("Field2");
                                    int Column3 = c.getColumnIndex("Field3");

                // Check if our result was valid.
                c.moveToFirst();
                if (c != null) {
                    // Loop through all Results
                    do {
                        String Name = c.getString(Column1);
                        String Model = c.getString(Column2);
                                                    String Price = c.getStrin(Column3);
                        Data = Data + "Maker: " + Name + "\n" + "Model: "
                                + Model + "\n" +"Price: " + Price+ "\n"+"\n";
                    } while (c.moveToNext());

                }
                //////////////////////////////////////////
                view2.setText(Data.toString());
            } catch (Exception e) {
                Log.e("Error", "Error", e);
            } finally {
                if (myDB != null)
                    myDB.close();
            }

        }
    });

    Button next = (Button) findViewById(R.id.buttonBack);
    next.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            Intent intent = new Intent();
            setResult(RESULT_OK, intent);
            finish();
        }

    });


}
}
</code></pre>

<p>Any suggestions ?</p>

<p>Thanks in advance.</p>
