mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2025-12-16 10:48:46 +00:00
Export lists to other apps
This commit is contained in:
parent
d117bfd05f
commit
d9dbe45d7b
@ -221,12 +221,19 @@ public class ListPage extends AppCompatActivity implements Requestor.Receiver, R
|
|||||||
exportItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
exportItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onMenuItemClick(MenuItem item) {
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
String listContent = "";
|
StringBuilder listContents = new StringBuilder();
|
||||||
|
|
||||||
|
for (int i = 0; i < pNames.size(); i++) {
|
||||||
|
if (Integer.parseInt(pQuantity.get(i)) == -1) {
|
||||||
|
listContents.append(String.format("\n%s\n", pNames.get(i)));
|
||||||
|
} else {
|
||||||
|
listContents.append(String.format(" %s of %s\n", pQuantity.get(i), pNames.get(i)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Intent sendIntent = new Intent();
|
Intent sendIntent = new Intent();
|
||||||
sendIntent.setAction(Intent.ACTION_SEND);
|
sendIntent.setAction(Intent.ACTION_SEND);
|
||||||
sendIntent.putExtra(Intent.EXTRA_TEXT, "this is my text test");
|
sendIntent.putExtra(Intent.EXTRA_TEXT, listContents.toString());
|
||||||
sendIntent.setType("text/plain");
|
sendIntent.setType("text/plain");
|
||||||
|
|
||||||
Intent shareIntent = Intent.createChooser(sendIntent, null);
|
Intent shareIntent = Intent.createChooser(sendIntent, null);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user