CLASS 1:
package com.testing.android;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
public class activity2hyperlink extends Activity implements
OnClickListener {
/** Called when the activity is first created. */
TextView t1;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
t1 = (TextView) findViewById(R.id.txt01);
t1.setOnClickListener(this);
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if (v == t1) {
Intent intent = new Intent(activity2hyperlink.this,
firstactivity.class);
startActivity(intent);
}
}
}
Class 2:
package com.testing.android;
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.Gravity;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.SimpleAdapter.ViewBinder;
public class firstactivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main2);
TextView t1= (TextView)findViewById(R.id.txt02);
// setContentView(t1);
}
}
MAIN:
<?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:id="@+id/txt01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Hai Do u want to go to Gmail?"
android:clickable="true"
/>
</LinearLayout>
MAIN 2
<?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:id="@+id/txt02"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="www.gmail.com"
android:autoLink="web"
android:clickable="true"
android:imeOptions ="actionGo"
/>
</LinearLayout>
MANIFEST.XML
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.testing.android"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/
app_name">
<activity android:name=".activity2hyperlink"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".firstactivity" android:label="@string/
app_name" />
</application>
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET"></uses-
permission>
</manifest>
output:
1st activity wil show Hai Do u want to go to Gmail
then if u click that link it will be display the gmail.com as wel as
it will be gone to gmail webpage directly
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en