Thursday 28 March 2013

Remove Default Background From custom Dialog also Dialog Activity


requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
        getWindow().setBackgroundDrawable(
new ColorDrawable(android.graphics.Color.TRANSPARENT));

Note: wirte AboveCode in OnCreate if create Activity As Custom Dialog 


=======================================================================

LayoutInflater dailog = LayoutInflater.from(context);
 final View deleteDialogView = dailog.inflate( R.layout.dailog_popup(Your Xml Layout Name), null);
        Dialog alertdailog = new Dialog(context);
   alertdailog .requestWindowFeature(Window.FEATURE_NO_TITLE);
  alertdailog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    alertdailog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
alertdailog.setContentView(your View Name);
alertdailog.setCanceledOnTouchOutside(true);

alertdailog.show();


Get Contact Title From Given Phone Number


String strOrder = ContactsContract.Contacts.DISPLAY_NAME;
String SELECTION = ContactsContract.Contacts.HAS_PHONE_NUMBER+ "='1'";
Uri uri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI,
Uri.encode(Your Phone Number);
Cursor objCursor = getContentResolver().query(uri,new String[] { PhoneLookup.DISPLAY_NAME },
SELECTION, null, strOrder);
if (objCursor.getCount() > 0)
{
    objCursor.moveToPosition(-1);

    while (objCursor.moveToNext())
   {
System.out.Println(objCursor.getString(objCursor.getColumnIndex(
       ContactsContract.Contacts.DISPLAY_NAME)));
    }
}
objCursor.close();

Tuesday 29 January 2013


Making TextView Scrollable in Android



just set the
android:maxLines="AN_INTEGER"
android:scrollbars="vertical"
propertied of your TextView in your layout's xml file.
Then use:
yourTextView.setMovementMethod(new ScrollingMovementMethod());
in your java code::