Skip to content

Instantly share code, notes, and snippets.

<manifest package="com.sample.app">
<queries>
<provider android:authorities="com.sample.share.files" />
</queries>
</manifest>
<manifest package="com.sample.app">
<queries>
<intent>
<action android:name="android.intent.action.SEND" />
<data android:mimeType="image/*" />
</intent>
<!-- Browser -->
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="http" />
<manifest package="com.sample.app">
<queries>
<package android:name="com.sample.messanger" />
<package android:name="com.sample.mail" />
</queries>
</manifest>
val intent = Intent(Intent.ACTION_VIEW, Uri.parse("https://sampleurl.com"))
val listofAppsInstalled : List<ResolveInfo> = context
.packageManager
.queryIntentActivities( intent, 0 )
val listofAppsInstalled : List<PackageInfo> = context
.packageManager
.getInstalledPackages(0)
val listofAppsInstalled : List<ApplicationInfo> = context
.packageManager
.getInstalledApplications(PackageManager.GET_META_DATA)
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:id="@+id/text_email"
package com.example
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_main.*
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
class ExampleActivity extends Activity {
@BindView(R.id.title) TextView title;
@BindView(R.id.subtitle) TextView subtitle;
@BindView(R.id.footer) TextView footer;
@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.example_activity);
ButterKnife.bind(this);
// TODO Use fields...