-
Notifications
You must be signed in to change notification settings - Fork 398
/
MainActivity.java
38 lines (30 loc) · 1.13 KB
/
MainActivity.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.google.firebase.dynamicinvites.view;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import android.view.View;
import com.google.firebase.dynamicinvites.R;
import com.google.firebase.dynamicinvites.util.DynamicLinksUtil;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
findViewById(R.id.buttonShare).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
onShareClicked();
}
});
}
// [START ddl_on_share_clicked]
private void onShareClicked() {
Uri link = DynamicLinksUtil.generateContentLink();
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, link.toString());
startActivity(Intent.createChooser(intent, "Share Link"));
}
// [END ddl_on_share_clicked]
}