2014-01-23 5 views
-1

내 코드가 내 앱이 열리지 못하게합니까? 오류는 없지만 열리지 않습니다. 또는 어딘가에서 충돌을 일으키는 분할 문자열에 문제가 있습니까?코드가 앱을 열 수 없습니까?

는 Mainactivity :

package com.pk.code; 

import android.app.Activity; 
import android.os.Bundle; 
import android.view.Menu; 
import android.widget.TextView; 

public class MainActivity extends Activity { 

    TextView smsText;@Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_main); 
     smsText = (TextView) findViewById(R.id.smsText); 

     Bundle extra = getIntent().getExtras(); 
     if (extra != null) { 
      String SMSText = extra.get("sms").toString(); 
      String[] splitted = SMSText.split("-"); 
      if (splitted.length > 1 && splitted.length < 4) { 
       smsText.setText(" " + splitted[0] + "," + " " + splitted[1]); 
      } else { 
       smsText.setText(SMSText); 


      } 
     } 
    } 


    @Override 
    public boolean onCreateOptionsMenu(Menu menu) { 
     // Inflate the menu; this adds items to the action bar if it is present. 
     getMenuInflater().inflate(R.menu.main, menu); 
     return true; 
    } 
} 
+0

어떻게 열려고합니까? 정확히 어떻게됩니까? –

+0

logcat은 무엇을 기록합니까? – taytay

답변

0

대부분의 아마 extra.get의 문제 ("SMS")는, 그것은 null를 돌려줍니다. 로그캣을 확인하고 충돌 후 여기에 인쇄하십시오.

관련 문제