High lite Specific text in Android Webview

this is main activity class


public class HighliteActivity extends Activity {

@SuppressLint("SetJavaScriptEnabled")
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

final WebView webView = (WebView) findViewById(R.id.webView);
webView.loadUrl("http://polamreddyn.blogspot.in/2013/01/android-text-links-using-linkify.html");

webView.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url) {
Log.i("", "" +url);

@SuppressWarnings("deprecation")
                              // here by default "of" selected
int i = webView.findAll("of"); // is not supposed to crash
Toast.makeText(getApplicationContext(), "Found " + i + " results !", Toast.LENGTH_SHORT).show();
try {
Method m = WebView.class.getMethod("setFindIsUp",Boolean.TYPE);
m.invoke(webView, true);
} catch (Throwable ignored) {
} }
});
}
}

Here `OF` word is selected





Button Animation Example

Android Button Animation Example

MainActivity .java


public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

final Animation animTranslate = AnimationUtils.loadAnimation(this,R.anim.anim_translate);
final Animation animAlpha = AnimationUtils.loadAnimation(this,R.anim.anim_alpha);
final Animation animScale = AnimationUtils.loadAnimation(this,R.anim.anim_scale);
final Animation animRotate = AnimationUtils.loadAnimation(this,R.anim.anim_rotate);

Button btnTranslate = (Button) findViewById(R.id.translate);
Button btnAlpha = (Button) findViewById(R.id.alpha);
Button btnScale = (Button) findViewById(R.id.scale);
Button btnRotate = (Button) findViewById(R.id.rotate);

btnTranslate.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View v) {
v.startAnimation(animTranslate);
}
});
btnAlpha.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View v) {
v.startAnimation(animAlpha);
}
});
btnScale.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View v) {
v.startAnimation(animScale);
}
});
btnRotate.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View v) {
v.startAnimation(animRotate);
}
});
}
XML 


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <Button
        android:id="@+id/translate"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_margin="10dp"
        android:text="Translate Animation" />

    <Button
        android:id="@+id/alpha"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_margin="10dp"
        android:text="Alpha Animation" />

    <Button
        android:id="@+id/scale"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_margin="10dp"
        android:text="Scale Animation" />

    <Button
        android:id="@+id/rotate"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_margin="10dp"
        android:text="Rotate Animation" />

</LinearLayout>

Create new fili in
  /res/anim/anim_alpha.xml


<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:interpolator="@android:anim/linear_interpolator" >

    <alpha
        android:duration="500"
        android:fromAlpha="1.0"
        android:repeatCount="1"
        android:repeatMode="reverse"
        android:toAlpha="0.1" />
</set>
 /res/anim/anim_rotate.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
   android:interpolator="@android:anim/linear_interpolator">
   <rotate
       android:fromDegrees="0"
       android:toDegrees="360"
       android:pivotX="50%"
       android:pivotY="50%"
       android:duration="500"
       android:startOffset="0"
       android:repeatCount="1"
       android:repeatMode="reverse" />
</set>

 /res/anim/anim_scale.xml


<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
   android:interpolator="@android:anim/linear_interpolator">
   <scale
       android:fromXScale="1.0"
       android:toXScale="3.0"
       android:fromYScale="1.0"
       android:toYScale="3.0"
       android:pivotX="50%"
       android:pivotY="50%"
       android:duration="500"
       android:repeatCount="1"
       android:repeatMode="reverse" />
</set>


 /res/anim/anim_translate.xml


<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:interpolator="@android:anim/linear_interpolator" >

    <translate

        android:duration="500"
        android:fromXDelta="0"
        android:repeatCount="1"
        android:repeatMode="reverse"
        android:toXDelta="100%p" />
</set>

All contacts Attatched to .vcf file And send to Mail

 Here is code get all contacts of your mobile and store to file and that file send to mail. see here http://stackoverflow.com/questions/12798001/android-how-to-send-multiple-contacts-are-attached-in-single-vcf-file-and-send


 button = (Button) findViewById(R.id.send);          
     button.setOnClickListener(new OnClickListener() {          
        public void onClick(View v) {        
            data();
        }
    });  
    getVcardString();           
}       

 public static void getVcardString() {   

    String path = null;     
    String vfile = null;

     vfile = "Contacts.vcf";           
    Cursor phones = mContext.getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null,
                    null, null, null);

    phones.moveToFirst();
    Log.i("Number of contacts", "cursorCount" +phones.getCount());  
    for(int i =0;i<phones.getCount();i++)   {       

         String lookupKey = phones.getString(phones.getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY));
         Log.i("lookupKey", " " +lookupKey);
         Uri uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_VCARD_URI, lookupKey);
         AssetFileDescriptor fd;

         try  {
             fd = mContext.getContentResolver().openAssetFileDescriptor(uri, "r");
             FileInputStream fis = fd.createInputStream();
             byte[] buf = new byte[(int) fd.getDeclaredLength()];
             fis.read(buf);
             String VCard = new String(buf);          

             path = Environment.getExternalStorageDirectory().toString() + File.separator + vfile;
             FileOutputStream mFileOutputStream = new FileOutputStream(path, true);
             mFileOutputStream.write(VCard.toString().getBytes());    

             phones.moveToNext();               

             filevcf = new File(path);
             Log.i("file", "file" +filevcf);

         }catch(Exception e1) {
             e1.printStackTrace();  
         }
    }       
    Log.i("TAG", "No Contacts in Your Phone");          
}

protected void data() {             
    File filelocation = filevcf ;     
    Intent sharingIntent = new Intent(Intent.ACTION_SEND);
    sharingIntent.setType("vnd.android.cursor.dir/email");      
    sharingIntent.setType("application/x-vcard");       
    sharingIntent.putExtra(Intent.EXTRA_EMAIL, "mail@gmail.com" );        
    sharingIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+filelocation.getAbsolutePath()));
    startActivity(Intent.createChooser(sharingIntent, "Send email"));            
 }  

Select DateRange UsingRangePicker.

  /* * This Method is for select range from picker. * */ private fun selectDateRangeUsingRangePicker () { pageNumber = 1 val displ...