Search code examples
javaandroidlogcat

i want to convert "LogCat Info" data into string from my android app


I am a beginner and I just want to convert the data of this logcat mainactivity into string.

I am using pushbots for notifications and I want the "bigText" to be displayed on the screen.

So how am I supposed to do that?

I want to convert the data in the logcat into string .. as you can see the data is in capital letters . please answer as soon as possible .

I am very curious to know. and please someone refer me a good website which can help me for this , it will also be helpful . Thank You

07-29 20:16:03.513    9243-9243/com.example.zia_ali.demopushnotification I/MainActivity﹕ Received message >> Bundle[{BigTextStyle=true, bigText=THIS IS THE TEXT I WANT TO CONVERT INTO STRING, from=381853524749, message=testing BigTextStyle, collapse_key=do_not_collapse}]

Solution

  • v1.

    Bundle extras = intent.getExtras();
    String message1 = extras.getString("bigText");
    TextView t2 = (TextView)findViewById(R.id.textView);
    t2.setText(message1);
    

    v2.

    Bundle extras = intent.getExtras();
    String bigText = null;
    if (extras != null && extras.containsKey("bigText")) {
        bigText = extras.getString("bigText");
    }
    TextView t2 = (TextView) findViewById(R.id.textView);
    t2.setText(bigText);