我想转换" LogCat Info"数据到我的Android应用程序的字符串

时间:2015-07-29 16:17:32

标签: java android logcat

我是初学者,我只想将此 logcat mainactivity的数据转换为字符串。

我正在使用pushbots进行通知,我想要" bigText"显示在屏幕上。

那我该怎么做呢?

我想将logcat中的数据转换为字符串..因为您可以看到数据是大写字母。请尽快回答。

我很想知道。请有人给我推荐一个可以帮助我的好网站,它也会有所帮助。谢谢

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}]

1 个答案:

答案 0 :(得分:0)

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);