Skip to content

Commit 4ae5d70

Browse files
author
Sharkbyteprojects
committed
modified: src/AndroidManifest.xml
modified: src/java/com/sharkbyte/qrcodegenerator/MainActivity.java
1 parent 4d04d03 commit 4ae5d70

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/AndroidManifest.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,13 @@
2525
<activity
2626
android:name=".MainActivity"
2727
android:exported="true">
28+
<intent-filter>
29+
<action android:name="android.intent.action.SEND" />
30+
<category android:name="android.intent.category.DEFAULT" />
31+
<data android:mimeType="text/plain" />
32+
</intent-filter>
2833
<intent-filter>
2934
<action android:name="android.intent.action.MAIN" />
30-
3135
<category android:name="android.intent.category.LAUNCHER" />
3236
</intent-filter>
3337
</activity>

src/java/com/sharkbyte/qrcodegenerator/MainActivity.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ public void errb(String message, String title){
5858
@Override
5959
protected void onCreate(Bundle savedInstanceState) {
6060
super.onCreate(savedInstanceState);
61-
6261
binding = ActivityMainBinding.inflate(getLayoutInflater());
6362
setContentView(binding.getRoot());
6463

@@ -145,6 +144,20 @@ public void onClick(View view) {
145144
closeKeyboard();
146145
}
147146
});
147+
148+
/* SHARE */
149+
Intent intent = getIntent();
150+
String action = intent.getAction();
151+
String type = intent.getType();
152+
if (Intent.ACTION_SEND.equals(action) && type != null) {
153+
if ("text/plain".equals(type)) {
154+
String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT);
155+
if (sharedText != null) {
156+
binding.textArea.setText(sharedText);
157+
}
158+
159+
}
160+
}
148161
qrupdate();
149162
}
150163

0 commit comments

Comments
 (0)