1 /*
2  * wpadebug - wpa_supplicant and Wi-Fi debugging app for Android
3  * Copyright (c) 2013, Jouni Malinen <j@w1.fi>
4  *
5  * This software may be distributed under the terms of the BSD license.
6  * See README for more details.
7  */
8 
9 package w1.fi.wpadebug;
10 
11 import android.app.Activity;
12 import android.os.Bundle;
13 import android.os.Parcelable;
14 import android.view.MenuItem;
15 import android.content.Intent;
16 import android.widget.TextView;
17 import android.text.method.ScrollingMovementMethod;
18 import android.util.Log;
19 
20 public class DisplayMessageActivity extends Activity
21 {
22     private static final String TAG = "wpadebug";
23 
byteArrayHex(byte[] a)24     String byteArrayHex(byte[] a) {
25 	StringBuilder sb = new StringBuilder();
26 	for (byte b: a)
27 	    sb.append(String.format("%02x", b));
28 	return sb.toString();
29     }
30 
31     @Override
onCreate(Bundle savedInstanceState)32     public void onCreate(Bundle savedInstanceState)
33     {
34 	Log.d(TAG, "onCreate");
35         super.onCreate(savedInstanceState);
36 
37 	// Get the message from the intent
38 	Intent intent = getIntent();
39 	String action = intent.getAction();
40 	Log.d(TAG, "onCreate: action=" + action);
41 
42 	String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
43 
44 	TextView textView = new TextView(this);
45 	textView.setText(message);
46 	textView.setMovementMethod(new ScrollingMovementMethod());
47         setContentView(textView);
48     }
49 }
50