How to make linkable TextView with Linkify

by Marco Rocco » Thu, 14 Oct 2010 01:32:18 GMT


Sponsored Links
 I would make a textview linkable, and i have tried with this code:

[...]
TextView textview;
for (int i = 0; i < 5; i++) {
        textview = new TextView(this);
        htmlString = "<a href=' http://www.google.com '>Try Me</a>";
        textview.setText(Html.fromHtml(htmlString));
        Linkify.addLinks(textview, Linkify.WEB_URLS);
        lx.addView(textview, layoutParams);
}
[...]

but when i click on a textview nothing happens!

Anyone can help me?

--



How to make linkable TextView with Linkify

by Dimitris » Thu, 14 Oct 2010 01:39:46 GMT


 I think you might have to call setMovementMethod() on your textview.

See:

 http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/text/Link.html 




--


Sponsored Links


Other Threads

1. Retrieving the path of a picture returned by ACTION_IMAGE_CAPTURE

Hi guys,

I am having a problem capturing an image from the built-in camera app
on the Samsung Galaxy S.  (I also posted this on StackOverflow)

I have a button on my app that when pressed launches the camera:
//-------------------------------------------------------------
ContentValues values = new ContentValues();
values.put(Images.Media.MIME_TYPE, "image/jpeg");

mPicUri = getContentResolver().insert(Media.EXTERNAL_CONTENT_URI,
values);

intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, mPicUri.getPath());
startActivityForResult(intent, REQ_CODE_TAKE_PIC);
//-------------------------------------------------------------

picture using the URI I passed to the intent. And so I have this on my
onActivityResult:
//-------------------------------------------------------------
Uri selectedImage = mPicUri;
String[] filePathColumn = {MediaStore.Images.Media.DATA};

Cursor cursor = getContentResolver().query(selectedImage,
filePathColumn, null, null, null);
cursor.moveToFirst();

int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
String filePath = cursor.getString(columnIndex);
cursor.close();
//-------------------------------------------------------------

And then using the variable filePath, I set the image in an ImageView.
I am getting no image, and when I stepped through the code, I found
out that BitmapFactory.decodeFile() is returning null.

Bitmap chosenPic = BitmapFactory.decodeFile(filePath);


So I tried a little more debugging. I found out that mPicUri returns a
seemingly valid URI, such as: content://media/external/images/media/90.
After the picture is taken and the user chooses to save the picture,
the cursor resolves to the following filePath: /sdcard/DCIM/Camera/
1285601413961.jpg. No bitmap is decoded though, BUT when I looked
through the gallery, the picture I just took is there. So I tried to
take a look at the URI of that picture, and this is what I got:

URI is:           content://media/external/images/media/91
File path is:     /sdcard/DCIM/Camera/2010-09-27 23.30.30.jpg

And so, it looks like the value I got from mPicUri is not the final
URI that will be used.

Am I missing a step here? All I really want to do is retrieve the file
of the just-taken picture.

Thanks in advance,
Zarah.

-- 

2. invertM also does a heap allocation

> You can create your own rotateM() method and use your own float[16] do

It also seems that android.opengl.Matrix.invertM also does a heap
allocation.
Is there a different library function that I can use for (general)
matrix inversion?

I have already created my own version, but if there is a faster built-
in method I would prefer to use that.

Thanks for any tips.

-- 

3. What's the status of installing a non-market apps?

4. Camera Application Not Working When I Test on My Phone

5. Sorting Bookmarks/Contacts or any other ContentProvider/Resolver

6. emulator proxy not working

7. How can I add a layout to another layout in java? (in xml it would be "include")