0

活動で乾杯してみました。私のアクティビティは、最初に次のようにGoogleMapで膨らみます

protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);     
            setContentView(R.layout.activity_detail_map_view);
}

次に、トーストを設定しますonResume()

public void onResume() {
    super.onResume(); 

     //---create the BroadcastReceiver when the SMS is sent---
        smsSentReceiver = new BroadcastReceiver(){
            @Override
            public void onReceive(Context arg0, Intent arg1) {

                switch (getResultCode())
                {
                    case Activity.RESULT_OK:
                        Toast.makeText(getBaseContext(), "SMS sent",
                            Toast.LENGTH_SHORT).show();
                        break;

しかし、トーストするはずの時間に、トーストが表示されません。何が間違っている可能性がありますか?ありがとう

4

1 に答える 1

0

getApplicationContext を使用しないでください: 試してください

Toast.makeText(youractivity.this,"SMS Sent",Toast.LENGTH_SHORT).show();

また、試してみてください

Toast.makeText(context,"SMS Sent",Toast.LENGTH_SHORT).show();
于 2013-03-30T09:57:56.713 に答える