1
- package com .nerdinand .smssender ;
1
+ package com .nerdinand .smsgateway ;
2
2
3
3
import android .app .Activity ;
4
4
import android .app .PendingIntent ;
12
12
import android .telephony .SmsManager ;
13
13
import android .view .Menu ;
14
14
import android .view .MenuItem ;
15
+ import android .view .View ;
16
+ import android .widget .ScrollView ;
15
17
import android .widget .TextView ;
16
18
17
19
import java .io .BufferedReader ;
@@ -26,15 +28,18 @@ public class MainActivity extends ActionBarActivity {
26
28
private static final String SENT = "SMS_SENT" ;
27
29
private static final String DELIVERED = "SMS_DELIVERED" ;
28
30
31
+ private TextView textTextView ;
32
+ private ScrollView scrollView ;
33
+
29
34
private ServerSocket serverSocket ;
30
35
private Handler updateConversationHandler ;
31
- private TextView textTextView ;
32
36
private Thread serverThread ;
37
+ private static CommunicationThread communicationThread ;
33
38
private SmsManager smsManager ;
34
39
35
40
private PendingIntent sentPendingIntent ;
36
41
private PendingIntent deliveredPendingIntent ;
37
- private static CommunicationThread communicationThread ;
42
+
38
43
private BroadcastReceiver sentBroadcastReceiver ;
39
44
private BroadcastReceiver deliveredBroadcastReceiver ;
40
45
@@ -44,6 +49,7 @@ protected void onCreate(Bundle savedInstanceState) {
44
49
setContentView (R .layout .activity_main );
45
50
46
51
textTextView = (TextView ) findViewById (R .id .tv_text );
52
+ scrollView = (ScrollView ) findViewById (R .id .sv_scroll_view );
47
53
48
54
if (savedInstanceState == null ) {
49
55
createInitially ();
@@ -235,6 +241,12 @@ public UpdateUIThreadRunnable(String str) {
235
241
@ Override
236
242
public void run () {
237
243
textTextView .setText (textTextView .getText ().toString () + msg + "\n " );
244
+ scrollView .post (new Runnable () {
245
+ @ Override
246
+ public void run () {
247
+ scrollView .fullScroll (View .FOCUS_DOWN );
248
+ }
249
+ });
238
250
}
239
251
}
240
252
}
0 commit comments