I found a strange problem on Jelly bean android 4.1 version till android 
4.0 its working fine .But in android 4.1 its creating problem..

below is my  Activity

ackage com.sample;

import android.os.Bundle;
import android.app.Activity;
import android.text.util.Linkify;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.Menu;
import android.view.View;
import android.widget.TextView;

public class MainActivity extends Activity {

    TextView tv;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
         tv = (TextView)findViewById(R.id.sampletext);
        registerForContextMenu(tv);
        
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
    
    @Override
    public void onCreateContextMenu(ContextMenu menu, View 
v,ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
                // Create your context menu here
    tv.setAutoLinkMask(Linkify.WEB_URLS);  
    menu.setHeaderTitle("Context Menu");
        menu.add(0, v.getId(), 0, "Action 1");
       
        
    }

}

Layout file ..


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android";
    xmlns:tools="http://schemas.android.com/tools";
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:text="111111111111111111111"
        android:autoLink="all"
        tools:context=".MainActivity"
        android:id="@+id/sampletext"
        android:clickable="true"
        
         />

In this i declared android:autoLink="all" , and registered for context menu 
as well,

so when long click its showing context menu and its going to dialer.. but 
dialer should work only on single click

Please suggest me the solutions, I think the problem comes with Jelly bean 
android 4.1 version.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to