Sharing Plain Text
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.setType("text/html");sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml("<p>This is the text that will be shared.</p>"));startActivity(Intent.createChooser(sharingIntent,"Share using"));Sharing binary objects (Images, videos etc.)
Intent sharingIntent = new Intent(Intent.ACTION_SEND);Uri screenshotUri = Uri.parse(path);sharingIntent.setType("image/png");sharingIntent.putExtra(Intent.EXTRA_STREAM, screenshotUri);startActivity(Intent.createChooser(sharingIntent, "Share image using"));Registering for the Intent
If you want your app to be listed when this Intent is called, then you have to add an intent filter in your manifest.xml file<intent-filter><action android:name="android.intent.action.SEND" /><category android:name="android.intent.category.DEFAULT" /><data android:mimeType="image/*" /></intent-filter>Use Android default Share Intent
Android Sample
Saturday, 21 June 2014
Open Defult Andaroid Share Intent and pass image Url and text
Thursday, 19 June 2014
Search Type for nerby places
Search by Places
Supported Place Types
This page lists the supported values for the
types property in the Google Places API. Table 1 lists the types you can use in place searches and place additions. Table 2lists the additional types that may be returned in the place search results. Table 3 lists the types you can use in place autocomplete requests.Table 1: Types supported in place search and addition
accountingairportamusement_parkaquariumart_galleryatmbakerybankbarbeauty_salonbicycle_storebook_storebowling_alleybus_stationcafecampgroundcar_dealercar_rentalcar_repaircar_washcasinocemeterychurchcity_hallclothing_storeconvenience_storecourthousedentistdepartment_storedoctorelectricianelectronics_store
embassyestablishmentfinancefire_stationfloristfoodfuneral_homefurniture_storegas_stationgeneral_contractorgrocery_or_supermarketgymhair_carehardware_storehealthhindu_templehome_goods_storehospitalinsurance_agencyjewelry_storelaundrylawyerlibraryliquor_storelocal_government_officelocksmithlodgingmeal_deliverymeal_takeawaymosquemovie_rentalmovie_theater
moving_companymuseumnight_clubpainterparkparkingpet_storepharmacyphysiotherapistplace_of_worshipplumberpolicepost_officereal_estate_agencyrestaurantroofing_contractorrv_parkschoolshoe_storeshopping_mallspastadiumstoragestoresubway_stationsynagoguetaxi_standtrain_stationtravel_agencyuniversityveterinary_carezoo
Table 2: Additional types returned by the Places service
The following types may be returned in the results of a place search, in addition to the types in table 1 above.
administrative_area_level_1administrative_area_level_2administrative_area_level_3administrative_area_level_4administrative_area_level_5colloquial_areacountryfloorgeocodeintersectionlocalitynatural_featureneighborhoodpoliticalpoint_of_interestpost_boxpostal_code
postal_code_prefixpostal_townpremiseroomroutestreet_addressstreet_numbersublocalitysublocality_level_4sublocality_level_5sublocality_level_3sublocality_level_2sublocality_level_1subpremisetransit_station
Table 3: Types supported in place autocomplete requests
You may restrict results from a Place Autocomplete request to be of a certain type by passing a
types parameter. The parameter specifies a type or a type collection, as listed in the supported types below. If nothing is specified, all types are returned. In general only a single type is allowed. The exception is that you can safely mix thegeocode and establishment types, but note that this will have the same effect as specifying no types. The supported types are:geocodeinstructs the Place Autocomplete service to return only geocoding (address) results. Generally, you use this request to disambiguate results where the location specified may be indeterminate.establishmentinstructs the Place Autocomplete service to return only business results.- the
(regions)type collection instructs the Places service to return any result matching the following types:localitysublocalitypostal_codecountryadministrative_area_level_1administrative_area_level_2
- the
(cities)type collection instructs the Places service to return results that matchlocalityoradministrative_area_level_3.
Retrieve distance from visible part of Google map
using VisibleRegion you can get the all corner cordinates and also the center
VisibleRegion vr = mMap.getProjection().getVisibleRegion();
double left = vr.latLngBounds.southwest.longitude;
double top = vr.latLngBounds.northeast.latitude;
double right = vr.latLngBounds.northeast.longitude;
double bottom = vr.latLngBounds.southwest.latitude;
Location MiddleLeftCornerLocation;//(center's latitude,vr.latLngBounds.southwest.longitude)
Location center=new Location("center");
center.setLatitude( vr.latLngBounds.getCenter().latitude);
center.setLongitude( vr.latLngBounds.getCenter().longitude);
float dis = center.distanceTo(MiddleLeftCornerLocation);//calculate distane between middleLeftcorner and center
Retrieve distance from visible part of Google map
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::
Subscribe to:
Comments (Atom)
