2

Here, the code below will share the content onclick. While sharing the content through other app there are two contents: one is ti - title, another is de - description. I want to make the title bold while sharing. Is that possible?

expListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {

    @Override
    public boolean onChildClick(ExpandableListView parent, View v,
                                int groupPosition, int childPosition, long id) {
        // TODO Auto-generated method stub

        TextView de = (TextView) v.findViewById(R.id.lblListItem);
        TextView ti = (TextView) v.findViewById(R.id.lblListHeader);


        String selected = ti.getText().toString() + de.getText().toString();
        Intent intent = new Intent(Intent.ACTION_SEND);
        intent.setType("text/plain");
        intent.putExtra(Intent.EXTRA_TEXT, selected);
        startActivity(Intent.createChooser(intent, "Share via"));

        return false;
    }
});
RonTLV
  • 2,376
  • 2
  • 24
  • 38
Dark Ninja
  • 149
  • 2
  • 13

4 Answers4

5

If you want to share any thing on Whatsapp then there is small trick just use "*" in starting of any text and ending of the text then your text on Whatsapp will show bold.

final Intent intent = new Intent(android.content.Intent.ACTION_SEND);
                    String shareMessage =  "*"+"Download theguruji app for more news\n\n"+"*";
                    intent.putExtra(Intent.EXTRA_TEXT, shareMessage);
                    intent.setType("text/plain");
                    startActivity(Intent.createChooser(intent, "Share  via"));
Praveen Kumar
  • 277
  • 2
  • 12
0

Assuming your question is how to make the title(ti) bold right before sharing, you can try:

ti.setTypeface(null, Typeface.BOLD);
0

It's almost impossible. Once you share text for other apps, this text is displayed control by these apps. You can't do anything in there. Unless they provide options for you to format text for display.

Lan Nguyen
  • 785
  • 5
  • 13
0

Considering your problem of Setting the content to bold you could do it via XML using the following code: android:textStyle="bold"

and via Java class i.e Programmatically using: textView.setTypeface(null, Typeface.BOLD);