Example usage for android.content Intent ACTION_CALL

List of usage examples for android.content Intent ACTION_CALL

Introduction

In this page you can find the example usage for android.content Intent ACTION_CALL.

Prototype

String ACTION_CALL

To view the source code for android.content Intent ACTION_CALL.

Click Source Link

Document

Activity Action: Perform a call to someone specified by the data.

Usage

From source file:com.bigpigs.fragments.SearchFragment.java

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
        @NonNull int[] grantResults) {
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);
    if (requestCode == callRequest)
        if (grantResults[0] == PermissionChecker.PERMISSION_GRANTED) {
            Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + "01266343244"));
            if (ActivityCompat.checkSelfPermission(getContext(),
                    Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
                return;
            }/*  ww w. j  a va 2 s.  co m*/
            startActivity(intent);
        }
}

From source file:com.ibuildapp.romanblack.MultiContactsPlugin.ContactDetailsActivity.java

/**
 * Opens a contact detial pare depending on contact type.
 *
 * @param position contact position//from   ww w .  j a v a2 s  .  co m
 */
private void listViewItemClick(int position) {
    try {//ErrorLogging

        int type = neededContacts.get(position).getType();
        switch (type) {
        case 0: {
        }
            break;
        case 1: {
            final String phoneNumber = neededContacts.get(position).getDescription();

            new CallDialog(this, phoneNumber, new CallDialog.ActionListener() {
                @Override
                public void onCall(DialogInterface dialog) {
                    dialog.dismiss();
                    Intent callIntent = new Intent(Intent.ACTION_CALL);
                    callIntent.setData(Uri.parse("tel:" + phoneNumber));
                    startActivity(callIntent);
                    overridePendingTransition(R.anim.activity_open_translate, R.anim.activity_close_scale);
                }

                @Override
                public void onAddContact(DialogInterface dialog) {
                    createNewContact(person.getName(), person.getPhone(), person.getEmail());
                    dialog.dismiss();
                }

                @Override
                public void onCancel(DialogInterface dialog) {
                    dialog.dismiss();
                }
            }).show();
        }
            break;
        case 2: {
            String email = neededContacts.get(position).getDescription();
            Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
            emailIntent.setType("text/html");
            emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { email });
            startActivity(emailIntent);
            overridePendingTransition(R.anim.activity_open_translate, R.anim.activity_close_scale);
        }
            break;
        case 3: {
            String url = neededContacts.get(position).getDescription();

            if (!url.startsWith("http://") && !url.startsWith("https://")) {
                url = "http://" + url;
            }

            Intent intent = new Intent(this, ContactsWebActivity.class);
            intent.putExtra("link", url);
            startActivity(intent);
            overridePendingTransition(R.anim.activity_open_translate, R.anim.activity_close_scale);
        }
            break;
        case 4: {
            Intent intent = new Intent(this, NativeMapActivity.class);
            intent.putExtra("person", person);
            startActivity(intent);
            overridePendingTransition(R.anim.activity_open_translate, R.anim.activity_close_scale);
        }
            break;
        }

    } catch (Exception e) {
        Log.e(TAG, e.getMessage());
        e.printStackTrace();
    }
}

From source file:com.ximai.savingsmore.save.activity.AddGoodsAcitivyt.java

@Override
public void onClick(View v) {
    switch (v.getId()) {
    case R.id.servise:
        Intent intent = new Intent();
        intent.setAction(Intent.ACTION_CALL);
        intent.setData(Uri.parse("tel:" + "58366991"));
        startActivity(intent);//  w  ww . j a v  a 2  s . com
        break;

    case R.id.one_classity:
        PopupWindowFromBottomUtil.shouRange(AddGoodsAcitivyt.this,
                LayoutInflater.from(AddGoodsAcitivyt.this).inflate(R.layout.business_my_center_activity, null),
                good_one_classify, new PopupWindowFromBottomUtil.Listener2() {
                    @Override
                    public void callBack(BaseMessage Id1, String content, PopupWindow popupWindow) {
                        yijifenlei.setTextColor(getResources().getColor(R.color.text_black));
                        yijifenlei.setText(Id1.Name);
                        myProduct.FirstClassId = Id1.Id;
                        oneId = Id1.Id;
                        popupWindow.dismiss();
                    }
                });
        break;
    case R.id.two_classity:
        if (null != oneId && !TextUtils.isEmpty(oneId)) {
            good_two_classify.clear();
            for (int i = 0; i < list.size(); i++) {
                if (null != list.get(i).Name && null != list.get(i).ParentId && null != list.get(i).Id
                        && list.get(i).ParentId.equals(oneId)) {
                    good_two_classify.add(list.get(i));
                }
            }
            PopupWindowFromBottomUtil.shouRange(
                    AddGoodsAcitivyt.this, LayoutInflater.from(AddGoodsAcitivyt.this)
                            .inflate(R.layout.business_my_center_activity, null),
                    good_two_classify, new PopupWindowFromBottomUtil.Listener2() {
                        @Override
                        public void callBack(BaseMessage Id1, String content, PopupWindow popupWindow) {
                            erjifenlei.setTextColor(getResources().getColor(R.color.text_black));
                            erjifenlei.setText(Id1.Name);
                            myProduct.SecondClassId = Id1.Id;
                            popupWindow.dismiss();
                        }
                    });
        } else {
            Toast.makeText(AddGoodsAcitivyt.this, "", Toast.LENGTH_SHORT).show();
        }
        break;
    case R.id.brand_name:
        PopupWindowFromBottomUtil.shouRange(AddGoodsAcitivyt.this,
                LayoutInflater.from(AddGoodsAcitivyt.this).inflate(R.layout.business_my_center_activity, null),
                brand_list, new PopupWindowFromBottomUtil.Listener2() {
                    @Override
                    public void callBack(BaseMessage Id1, String content, PopupWindow popupWindow) {
                        brand.setTextColor(getResources().getColor(R.color.text_black));
                        brand.setText(Id1.Name);
                        myProduct.BrandId = Id1.Id;
                        popupWindow.dismiss();
                    }
                });
        break;
    case R.id.xingshi_item:
        PopupWindowFromBottomUtil.shouSalesType(AddGoodsAcitivyt.this,
                LayoutInflater.from(AddGoodsAcitivyt.this).inflate(R.layout.business_my_center_activity, null),
                goodSalesTypes, new PopupWindowFromBottomUtil.Listenrt3() {
                    @Override
                    public void callback(GoodSalesType goodSalesType, PopupWindow popupWindow) {
                        myProduct.PromotionType = goodSalesType.Id;
                        yuan_price.setText("");
                        cuxiao_price.setText("");
                        cuxiao_text.setText("");
                        xingshi.setTextColor(getResources().getColor(R.color.text_black));
                        xingshi.setText(goodSalesType.Value);
                        xingshi_id = goodSalesType.Id;
                        if (goodSalesType.Id.equals("5")) {
                            yuan_price.setText("10");
                            cuxiao_price.setText("10");
                        } else if (goodSalesType.Id.equals("6")) {
                            yuan_price.setText("1");
                            cuxiao_price.setText("1");
                        } else if (goodSalesType.Id.equals("11")) {
                            yuan_price.setText("0");
                            cuxiao_price.setText("0");
                        } else if (goodSalesType.Id.equals("2")) {
                            cuxiao_text.setText("N?N");

                        }
                        popupWindow.dismiss();
                    }
                });
        break;
    case R.id.dizhi_item:
        PopupWindowFromBottomUtil.showAddress(AddGoodsAcitivyt.this,
                LayoutInflater.from(AddGoodsAcitivyt.this).inflate(R.layout.business_my_center_activity, null),
                list, new PopupWindowFromBottomUtil.Listenre1() {
                    @Override
                    public void callBack(String Id1, String Id2, String Id3, String content,
                            PopupWindow popupWindow) {
                        myProduct.ProvinceId = Id1;
                        myProduct.CityId = Id2;
                        myProduct.AreaId = Id3;
                        dizhi.setTextColor(getResources().getColor(R.color.text_black));
                        dizhi.setText(content);
                        popupWindow.dismiss();
                    }
                });
        break;
    case R.id.start_time_item:
        UsePicker.showAll(AddGoodsAcitivyt.this, new UsePicker.CallBack() {
            @Override
            public void callBack(String time) {
                SimpleDateFormat dd = new SimpleDateFormat("yyyy-MM-dd HH:mm");
                Date date1 = null;
                try {
                    date1 = dd.parse(time);
                } catch (ParseException e) {
                    e.printStackTrace();
                }
                Long time1 = date1.getTime();
                Date dt = new Date();
                Long now = dt.getTime();
                if (now > time1) {
                    Toast.makeText(AddGoodsAcitivyt.this, "??",
                            Toast.LENGTH_SHORT).show();
                } else {
                    start_date = time;
                    myProduct.StartTime = time;
                    start.setTextColor(getResources().getColor(R.color.text_black));
                    start.setText(time);
                }
            }
        }, start.getText().toString());
        break;
    case R.id.end_time_item:
        UsePicker.showAll(AddGoodsAcitivyt.this, new UsePicker.CallBack() {
            @Override
            public void callBack(String time) {
                SimpleDateFormat dd = new SimpleDateFormat("yyyy-MM-dd");

                try {
                    Date date1 = dd.parse(start_date);
                    Date date2 = dd.parse(time);
                    Long time1 = date1.getTime();
                    Long time2 = date2.getTime();
                    if ((time2 > time1)) {
                        myProduct.EndTime = time;
                        end.setTextColor(getResources().getColor(R.color.text_black));
                        end.setText(time);
                    } else {
                        Toast.makeText(AddGoodsAcitivyt.this, "??",
                                Toast.LENGTH_SHORT).show();
                    }
                } catch (ParseException e) {
                    e.printStackTrace();
                }

            }
        }, end.getText().toString());
        break;
    case R.id.danwei_item:
        PopupWindowFromBottomUtil.shouRange(AddGoodsAcitivyt.this,
                LayoutInflater.from(AddGoodsAcitivyt.this).inflate(R.layout.business_my_center_activity, null),
                danwei_list, new PopupWindowFromBottomUtil.Listener2() {
                    @Override
                    public void callBack(BaseMessage Id1, String content, PopupWindow popupWindow) {
                        myProduct.UnitId = Id1.Id;
                        danwei.setTextColor(getResources().getColor(R.color.text_black));
                        danwei.setText(Id1.Name);
                        popupWindow.dismiss();
                    }
                });
        break;
    case R.id.bizhong_item:
        PopupWindowFromBottomUtil.shouRange(AddGoodsAcitivyt.this,
                LayoutInflater.from(AddGoodsAcitivyt.this).inflate(R.layout.business_my_center_activity, null),
                bizhong_list, new PopupWindowFromBottomUtil.Listener2() {
                    @Override
                    public void callBack(BaseMessage Id1, String content, PopupWindow popupWindow) {
                        myProduct.CurrencyId = Id1.Id;
                        bizhong.setTextColor(getResources().getColor(R.color.text_black));
                        bizhong.setText(Id1.Name);
                        popupWindow.dismiss();
                    }
                });
        break;
    case R.id.fapiao_item:
        PopupWindowFromBottomUtil.shouRange(AddGoodsAcitivyt.this,
                LayoutInflater.from(AddGoodsAcitivyt.this).inflate(R.layout.business_my_center_activity, null),
                fapiao_list, new PopupWindowFromBottomUtil.Listener2() {
                    @Override
                    public void callBack(BaseMessage Id1, String content, PopupWindow popupWindow) {
                        myProduct.InvoiceId = Id1.Id;
                        fapiao.setTextColor(getResources().getColor(R.color.text_black));
                        fapiao.setText(Id1.Name);
                        popupWindow.dismiss();
                    }
                });
        break;
    case R.id.btnCancel:
        setIconWindow.dismiss();
        break;
    case R.id.btnCamera:
        openCamera();
        setIconWindow.dismiss();
        break;
    case R.id.btnAlbum:
        openAlbum();
        setIconWindow.dismiss();
        break;
    case R.id.fabu:
        myProduct.Name = my_name.getText().toString();
        myProduct.Name = product_name.getText().toString();
        myProduct.Number = product_bianhao.getText().toString();
        myProduct.Address = xiangxi_address.getText().toString();
        myProduct.OriginalPrice = yuan_price.getText().toString();
        myProduct.Price = cuxiao_price.getText().toString();
        myProduct.Introduction = explain.getText().toString();
        myProduct.Description = explain.getText().toString();
        myProduct.Images = images;
        if (myProduct.Images.size() > 0 && null != myProduct.Name && null != myProduct.CityId
                && null != myProduct.InvoiceId && null != myProduct.Address && null != myProduct.AreaId
                && null != myProduct.BrandId && null != myProduct.CurrencyId && null != myProduct.CityId
                && null != myProduct.Description && null != myProduct.EndTime && null != myProduct.Description
                && null != myProduct.FirstClassId && null != myProduct.SecondClassId
                && null != myProduct.Description) {
            saveMyProduct(myProduct);
        } else {
            Toast.makeText(AddGoodsAcitivyt.this, "?", Toast.LENGTH_SHORT).show();
        }

        break;

    }
}

From source file:com.newcell.calltext.service.SipNotifications.java

public void showNotificationForVoiceMail(SipProfile acc, int numberOfMessages) {
    if (messageVoicemail == null) {

        messageVoicemail = new NotificationCompat.Builder(context);
        messageVoicemail.setSmallIcon(android.R.drawable.stat_notify_voicemail);
        messageVoicemail.setTicker(context.getString(R.string.voice_mail));
        messageVoicemail.setWhen(System.currentTimeMillis());
        messageVoicemail.setDefaults(Notification.DEFAULT_ALL);
        messageVoicemail.setAutoCancel(true);
        messageVoicemail.setOnlyAlertOnce(true);
    }//from www.  ja  va 2 s .  com

    PendingIntent contentIntent = null;
    Intent notificationIntent;
    /*
     * 8/06/2014 Removed check for voicemail number. Changed it to call *86
             
    if (acc != null && !TextUtils.isEmpty(acc.vm_nbr) && acc.vm_nbr != "null") {
    notificationIntent = new Intent(Intent.ACTION_CALL);
    notificationIntent.setData(SipUri.forgeSipUri(SipManager.PROTOCOL_CSIP, acc.vm_nbr
            + "@" + acc.getDefaultDomain()));
    notificationIntent.putExtra(SipProfile.FIELD_ACC_ID, acc.id);
    }
            
     * 
     */
    if (acc != null) {
        notificationIntent = new Intent(Intent.ACTION_CALL);
        notificationIntent.setData(SipUri.forgeSipUri(SipManager.PROTOCOL_CSIP, "*86"));
        notificationIntent.putExtra(SipProfile.FIELD_ACC_ID, acc.id);
    } else {
        notificationIntent = new Intent(SipManager.ACTION_SIP_DIALER);
    }
    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    contentIntent = PendingIntent.getActivity(context, 0, notificationIntent,
            PendingIntent.FLAG_CANCEL_CURRENT);

    String messageText = "";
    /*
     * 6/11/2014 Removed account name from voicemail notification
             
    if (acc != null) {
    messageText += acc.getProfileName() + " : ";
    }
            
     * 6/11/2014 Removed account name from voicemail notification
     */
    messageText = Integer.toString(numberOfMessages);
    messageText += " new " + context.getString(R.string.voice_mail);
    if (numberOfMessages > 1)
        messageText += "s";

    messageVoicemail.setContentTitle(context.getString(R.string.voice_mail));
    messageVoicemail.setContentText(messageText);
    if (contentIntent != null) {
        messageVoicemail.setContentIntent(contentIntent);
        notificationManager.notify(VOICEMAIL_NOTIF_ID, messageVoicemail.build());
    }
}

From source file:com.example.sujit.customerapp.Get_Taxi.java

private void callDriver() {
    Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + textViewMobile1.getText()));
    if (ActivityCompat.checkSelfPermission(Get_Taxi.this,
            Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
        // TODO: Consider calling
        //    ActivityCompat#requestPermissions
        // here to request the missing permissions, and then overriding
        //   public void onRequestPermissionsResult(int requestCode, String[] permissions,
        //                                          int[] grantResults)
        // to handle the case where the user grants the permission. See the documentation
        // for ActivityCompat#requestPermissions for more details.
        return;/*from w w w.jav  a  2 s  .  co  m*/
    }
    startActivity(intent);
}

From source file:org.apps8os.motivator.ui.MainActivity.java

/**
 * Calls the substance work number/*from  w w w. jav a2 s  .  co  m*/
 * @param view
 */
public void callSubstanceWork(View view) {
    Intent callIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + "080090045"));
    startActivity(callIntent);
}

From source file:com.gizwits.aircondition.activity.control.MainControlActivity.java

/**
 * Inits the views.//from w w w .j  av a  2s  .  c  o m
 */
private void initViews() {
    mView = (SlidingMenu) findViewById(R.id.main_layout);
    rlControlMainPage = (RelativeLayout) findViewById(R.id.rlControlMainPage);
    // rlHeader = (RelativeLayout) findViewById(R.id.rlHeader);
    rlAlarmTips = (RelativeLayout) findViewById(R.id.rlAlarmTips);
    rlPowerOff = (RelativeLayout) findViewById(R.id.rlPowerOff);
    // llFooter = (LinearLayout) findViewById(R.id.llFooter);
    llBottom = (LinearLayout) findViewById(R.id.llBottom);
    ivMenu = (ImageView) findViewById(R.id.ivMenu);
    tvTitle = (TextView) findViewById(R.id.tvTitle);
    ivPower = (ImageView) findViewById(R.id.ivPower);
    ivBack = (ImageView) findViewById(R.id.ivBack);
    tvAlarmTipsCount = (TextView) findViewById(R.id.tvAlarmTipsCount);
    tvTimeOff = (TextView) findViewById(R.id.tvTimeOff);
    tvAdvanture = (TextView) findViewById(R.id.tvAdvanture);
    tvCurve = (TextView) findViewById(R.id.tvCurve);
    ctvUnit = (CheckedTextView) findViewById(R.id.tvUnit);
    tvMode = (TextView) findViewById(R.id.tvMode);
    tvInnerTemperature = (TextView) findViewById(R.id.tvInnerTemperature);
    tvInnerUnit = (TextView) findViewById(R.id.tvInnerUnit);
    tvSettingTemerature = (TextView) findViewById(R.id.tvSettingTemerature);
    tvSettingUnit = (TextView) findViewById(R.id.tvSettingUnit);
    tvPowerOn = (TextView) findViewById(R.id.tvPowerOn);
    tvPowerOnStr = (TextView) findViewById(R.id.tvPowerOnStr);
    ibLeftArrow = (ImageButton) findViewById(R.id.ibLeftArrow);
    ibRightArrow = (ImageButton) findViewById(R.id.ibRightArrow);
    rgWing = (RadioGroup) findViewById(R.id.rgWing);
    rbWindLow = (RadioButton) findViewById(R.id.rbWindLow);
    rbWindMin = (RadioButton) findViewById(R.id.rbWindMin);
    rbWindHigh = (RadioButton) findViewById(R.id.rbWindHigh);
    cbWindShake = (CheckBox) findViewById(R.id.cbWindShake);
    sclContent = (ScrollView) findViewById(R.id.sclContent);
    seekBar = (CircularSeekBar) findViewById(R.id.csbSeekbar);
    seekBar.postInvalidateDelayed(2000);
    seekBar.setMaxProgress(100);
    seekBar.setProgress(30);
    seekBar.setMProgress(0);
    seekBar.setScrollViewInParent(sclContent);
    seekBar.postInvalidateDelayed(100);
    seekBar.setSeekBarChangeListener(new CircularSeekBar.OnSeekChangeListener() {
        @Override
        public void onProgressChange(CircularSeekBar view, int newProgress) {
            mCenter.cSetTemp(mXpgWifiDevice, temperatureC);
        }
    });
    seekBar.setSeekContinueChangeListener(new CircularSeekBar.OnSeekContinueChangeListener() {
        @Override
        public void onProgressContinueChange(CircularSeekBar view, int newProgress) {
            temperatureC = (short) (newProgress * 14 / 100.00 + 16);
            temperatureF = (short) getCelToFah(temperatureC);
            tvSettingTemerature.setText((isCentigrade ? temperatureC : temperatureF) + "");
            tvSettingUnit.setText(isCentigrade ? "" : "");
        }
    });
    mPowerOffDialog = DialogManager.getPowerOffDialog(this, new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            mCenter.cSwitchOn(mXpgWifiDevice, false);
            DialogManager.dismissDialog(MainControlActivity.this, mPowerOffDialog);
        }
    });

    mFaultDialog = DialogManager.getDeviceErrirDialog(MainControlActivity.this, "",
            new OnClickListener() {

                @Override
                public void onClick(View v) {
                    Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:10086"));
                    startActivity(intent);
                    mFaultDialog.dismiss();
                }
            });

    mAdapter = new MenuDeviceAdapter(this, bindlist);
    lvDevice = (ListView) findViewById(R.id.lvDevice);
    lvDevice.setAdapter(mAdapter);

    progressDialogRefreshing = new ProgressDialog(MainControlActivity.this);
    progressDialogRefreshing.setMessage("?,??");
    progressDialogRefreshing.setCancelable(false);

    mDisconnectDialog = DialogManager.getDisconnectDialog(this, new OnClickListener() {
        @Override
        public void onClick(View v) {
            DialogManager.dismissDialog(MainControlActivity.this, mDisconnectDialog);
            IntentUtils.getInstance().startActivity(MainControlActivity.this, DeviceListActivity.class);
            finish();
        }
    });
}

From source file:cn.jasonlv.siri.activity.MainActivity.java

public void onProcessingResult(ArrayList<String> nbest, String json_res, int fragmentId) {
    Intent intent = mPackageManager.getInstalledIntentByName(nbest.get(0));
    ContactsManager.Contact contact = mContactManager.getContactInfo(nbest);

    if (null != contact) {
        Log.e("f**k", contact.name + " : " + contact.number);

        getFragmentManager().beginTransaction().replace(fragmentId,
                TextFragment.newInstance(contact.name + "\n" + contact.number + "\n", null)).commit();

    }/*from   ww w .  j a  v  a  2  s. c o m*/

    /**
     * 
     *
     * 
     * 
     * 
     */

    else if (intent != null) {

        //txtResult.setText("" + nbest.get(0) + "...");
        mSynthesizer.speak("" + nbest.get(0));
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        getFragmentManager().beginTransaction()
                .replace(fragmentId, TextFragment.newInstance("" + nbest.get(0), null)).commit();

        startActivity(intent);
        //txtResult.setText(": " + nbest.get(0));
    } else if (nbest.get(0).startsWith("")) {
        intent = mPackageManager.getInstalledIntentByName(nbest.get(0).substring(4));
        if (intent != null) {
            getFragmentManager().beginTransaction()
                    .replace(fragmentId, TextFragment.newInstance(nbest.get(0).substring(2), null)).commit();
            startActivity(intent);
        }
    } else if (nbest.get(0).startsWith("")) {
        intent = mPackageManager.getInstalledIntentByName(nbest.get(0).substring(2));
        if (intent != null) {
            startActivity(intent);
        }

    } else if (nbest.get(0).contains("?")) {
        mSynthesizer.speak("??");
        getFragmentManager().beginTransaction()
                .replace(fragmentId, TextFragment.newInstance("??", null)).commit();
    }

    else if (nbest.get(0).startsWith("")) {
        if (nbest.get(0).endsWith("?")) {

            String number = mContactManager
                    .getContactNumber(nbest.get(0).substring(1, nbest.get(0).length() - 3));
            if (number != null) {

                getFragmentManager().beginTransaction()
                        .replace(fragmentId, TextFragment.newInstance("Call: " + number, null)).commit();

                Intent i = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + number));
                startActivity(i);
            } else {
                getFragmentManager().beginTransaction()
                        .replace(fragmentId, TextFragment.newInstance("~", null)).commit();
                mSynthesizer.speak("");

            }
        } else if (nbest.get(0).endsWith("?")) {
            getFragmentManager().beginTransaction().replace(fragmentId, TextFragment.newInstance("", null))
                    .commit();

        }

    }

    /**
     * 
     *
     *
     */
    else if (SymaticParser.isAlarmEvents(nbest.get(0))) {
        SymaticParser.extractAlarmEvents(nbest.get(0), getApplicationContext());
    } else if (SymaticParser.isAboutTodo(nbest.get(0))) {
        try {
            SymaticParser.extractTodoItem(nbest.get(0), getBaseContext());
        } catch (ParseException e) {
            e.printStackTrace();
        }
    }

    /**
     * 
     */
    else if (nbest.get(0).contains("")) {
        String songname = musicManager.playRandom();
        if (songname != null) {
            getFragmentManager().beginTransaction()
                    .replace(fragmentId, TextFragment.newInstance(songname, null)).commit();
        }

    }
    /**
     * ?
     *
     * ??
     * ?
     * 
     *
     *
     */

    else if (nbest.get(0).endsWith("") && nbest.get(0).startsWith("?")) {
        String keyword = nbest.get(0).substring(2, nbest.get(0).length() - 3);
        Intent intent1 = new Intent(this, SimpleImageActivity.class);
        intent1.putExtra(Constant.Extra.FRAGMENT_INDEX, ImageGridFragment.INDEX);
        intent1.putExtra("KEYWORD", keyword);
        startActivity(intent1);
    } else if (nbest.get(0).endsWith("") && nbest.get(0).startsWith("?")) {
        String keyword = nbest.get(0).substring(2, nbest.get(0).length() - 2);
        Intent intent1 = new Intent(this, SimpleImageActivity.class);
        intent1.putExtra(Constant.Extra.FRAGMENT_INDEX, ImageGridFragment.INDEX);
        intent1.putExtra("KEYWORD", keyword);
        startActivity(intent1);
    } else if (nbest.get(0).endsWith("")) {
        String keyword = nbest.get(0).substring(0, nbest.get(0).length() - 2);
        Intent intent1 = new Intent(this, SimpleImageActivity.class);
        intent1.putExtra(Constant.Extra.FRAGMENT_INDEX, ImageGridFragment.INDEX);
        intent1.putExtra("KEYWORD", keyword);
        startActivity(intent1);
    }

    /**
     * 
     *
     * 
     * 
     * 
     */

    else if (nbest.get(0).startsWith("")) {
        getFragmentManager().beginTransaction().replace(fragmentId, TodoEditorFragment.newInstance("a", "a"))
                .commit();
    } else if (nbest.get(0).startsWith("") || nbest.get(0).contains("")) {
        Intent in = new Intent(this, TodoActivity.class);
        startActivity(in);
    }

    /**
     * :
     *
     * ?
     */

    else if (SymaticParser.isAboutMapIntent(nbest.get(0))) {
        ArrayList<String> ends = SymaticParser.extractMapEnds(nbest.get(0));

        //APPAndroid, .
        try {

            /*
                    
            "intent://map/direction?origin=latlng:34.264642646862,108.95108518068
            |name:&destination=?&mode=driving&region=
            &src=yourCompanyName|yourAppName#Intent;scheme=bdapp;package=com.baidu.BaiduMap;end"
                    
            45.75 126.63
             */

            intent = Intent.getIntent("intent://map/direction?origin=latlng:45.75,126.63|name:" + ends.get(0)
                    + "&destination=" + ends.get(1)
                    + "&mode=driving&region=&src=EDI#Intent;scheme=bdapp;package=com.baidu.BaiduMap;end");
        } catch (Exception e) {
            e.printStackTrace();
            Intent browserIntent = new Intent(Intent.ACTION_VIEW,
                    Uri.parse("http://api.map.baidu.com/direction?" + "|name:" + ends.get(0) + "&destination="
                            + ends.get(1) + "&mode=driving&output=html&src=yourCompanyName|yourAppName"));
            startActivity(browserIntent);
        }
        startActivity(intent); //?
    }

    /**
     * .
     *
     */
    else if (nbest.get(0).contains("")) {
        getFragmentManager().beginTransaction()
                .replace(fragmentId, WeatherFragment.newInstance(info.lat, info.lon)).commit();
    } else if (nbest.get(0).startsWith("")) {
        new TranslateGetter().execute(nbest.get(0).substring(2));
    }

    /**
     * ?
     *
     * ?
     * ??
     *  ?
     */

    else if (nbest.get(0).endsWith("?")) {
        getFragmentManager().beginTransaction()
                .replace(fragmentId,
                        SearchFragment.newInstance(nbest.get(0).substring(0, nbest.get(0).length() - 2)))
                .commit();
    }

    else if (nbest.get(0).startsWith("?")) {
        getFragmentManager().beginTransaction()
                .replace(fragmentId, SearchFragment.newInstance(nbest.get(0).substring(2))).commit();
    }

    /**
     *  ?
     *
     *  
     *  
     *  ?
     *  ?
     *  
     *
     */
    else {

        try {
            String videoname = null;
            String bookname = null;
            String musicname = null;
            String person = null;
            videoname = SymaticParser.isMovieInfo(json_res);
            bookname = SymaticParser.isNovelInfo(json_res);
            musicname = SymaticParser.isMusicInfo(json_res);

            person = SymaticParser.isPersonInfo(json_res);

            if (videoname != null || bookname != null || musicname != null) {
                getFragmentManager().beginTransaction()
                        .replace(fragmentId, DoubanFragment.newInstance(videoname, musicname, bookname))
                        .commit();
            } else if (person != null) {
                getFragmentManager().beginTransaction().replace(fragmentId, SearchFragment.newInstance(person))
                        .replace(fragmentId, SearchFragment.newInstance(person)).commit();
            }

            /**
             * ?.
             */

            else {
                new RobotGetter().execute(nbest.get(0));
            }

        } catch (JSONException e) {
            e.printStackTrace();
            ;
        }

    }
    /*else {
        new WikiGetter().execute(nbest.get(0));
    }
    */
}

From source file:com.sonetel.service.SipNotifications.java

public void showNotificationForVoiceMail(SipProfile acc, int numberOfMessages) {
    if (messageVoicemail == null) {

        messageVoicemail = new NotificationCompat.Builder(context);
        messageVoicemail.setSmallIcon(android.R.drawable.stat_notify_voicemail);
        messageVoicemail.setTicker(context.getString(R.string.voice_mail));
        messageVoicemail.setWhen(System.currentTimeMillis());
        messageVoicemail.setDefaults(Notification.DEFAULT_ALL);
        messageVoicemail.setAutoCancel(true);
        messageVoicemail.setOnlyAlertOnce(true);
    }//from  ww  w.j av a 2  s .  c o  m

    PendingIntent contentIntent = null;
    Intent notificationIntent;
    if (acc != null && !TextUtils.isEmpty(acc.vm_nbr) && acc.vm_nbr != "null") {
        notificationIntent = new Intent(Intent.ACTION_CALL);
        notificationIntent.setData(
                SipUri.forgeSipUri(SipManager.PROTOCOL_CSIP, acc.vm_nbr + "@" + acc.getDefaultDomain()));
        notificationIntent.putExtra(SipProfile.FIELD_ACC_ID, acc.id);
    } else {
        notificationIntent = new Intent(SipManager.ACTION_SIP_DIALER);
    }
    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    contentIntent = PendingIntent.getActivity(context, 0, notificationIntent,
            PendingIntent.FLAG_CANCEL_CURRENT);

    String messageText = "";
    if (acc != null) {
        messageText += acc.getProfileName() + " : ";
    }
    messageText += Integer.toString(numberOfMessages);

    messageVoicemail.setContentTitle(context.getString(R.string.voice_mail));
    messageVoicemail.setContentText(messageText);
    if (contentIntent != null) {
        messageVoicemail.setContentIntent(contentIntent);
        notificationManager.notify(VOICEMAIL_NOTIF_ID, messageVoicemail.getNotification());
    }
}

From source file:miguelmaciel.play.anonymouscall.ui.ContactsListFragment.java

private void callPhoneNumber(String phoneNumber) {
    Intent intent = new Intent(Intent.ACTION_CALL);
    //Or replace the # by %23
    intent.setData(Uri.parse("tel:" + Uri.encode("#31#") + phoneNumber));
    startActivity(intent);//w w  w  .j a v  a 2  s.  c om
}