Example usage for android.content Intent getStringArrayExtra

List of usage examples for android.content Intent getStringArrayExtra

Introduction

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

Prototype

public String[] getStringArrayExtra(String name) 

Source Link

Document

Retrieve extended data from the intent.

Usage

From source file:com.tml.sharethem.sender.SHAREthemService.java

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    if (null != intent) {
        String action = intent.getAction();
        switch (action) {
        case WIFI_AP_ACTION_START:
            if (!hotspotControl.isEnabled()) {
                startFileHostingServer(intent.getStringArrayExtra(EXTRA_FILE_PATHS),
                        intent.getIntExtra(EXTRA_PORT, 0), intent.getStringExtra(EXTRA_SENDER_NAME));
            }/*from  ww  w.j av a2s. c om*/
            //                    sendAcknowledgementBroadcast(AP_ENABLED_ACKNOWLEDGEMENT);
            break;
        case WIFI_AP_ACTION_STOP:
            disableHotspotAndStop();
            break;
        case WIFI_AP_ACTION_START_CHECK:
            if (null != hotspotControl && hotspotControl.isEnabled()) {
                //starts a handler in loop to check Hotspot check. Service kills itself when Hotspot is no more alive
                if (null == hotspotCheckHandler)
                    hotspotCheckHandler = new HotspotChecker(this);
                else
                    hotspotCheckHandler.removeMessages(AP_ALIVE_CHECK);
                hotspotCheckHandler.sendEmptyMessageDelayed(100, 3000);
            }
            break;
        }
    }
    return START_NOT_STICKY;
}

From source file:com.anysoftkeyboard.ui.SendBugReportUiActivity.java

public void onSendCrashReport(View v) {
    String[] recipients = new String[] { BuildConfig.CRASH_REPORT_EMAIL_ADDRESS };

    Intent sendMail = new Intent();
    sendMail.setAction(Intent.ACTION_SEND);
    sendMail.setType("plain/text");
    sendMail.putExtra(Intent.EXTRA_EMAIL, recipients);
    sendMail.putExtra(Intent.EXTRA_SUBJECT, getText(R.string.ime_crashed_title));
    sendMail.putExtra(Intent.EXTRA_TEXT, mCrashReportDetails.crashReportText);

    try {/*ww  w. j a v  a 2  s.c  o  m*/
        Intent sender = Intent.createChooser(sendMail, getString(R.string.ime_crashed_intent_selector_title));
        sender.putExtra(Intent.EXTRA_EMAIL, sendMail.getStringArrayExtra(Intent.EXTRA_EMAIL));
        sender.putExtra(Intent.EXTRA_SUBJECT, sendMail.getStringExtra(Intent.EXTRA_SUBJECT));
        sender.putExtra(Intent.EXTRA_TEXT, mCrashReportDetails.crashReportText);

        Log.i(TAG, "Will send crash report using " + sender);
        startActivity(sender);
    } catch (android.content.ActivityNotFoundException ex) {
        Toast.makeText(getApplicationContext(), "Unable to send bug report via e-mail!", Toast.LENGTH_LONG)
                .show();
    }

    finish();
}

From source file:com.yek.keyboard.ui.SendBugReportUiActivity.java

public void onSendCrashReport(View v) {
    String[] recipients = new String[] { BuildConfig.CRASH_REPORT_EMAIL_ADDRESS };

    Intent sendMail = new Intent();
    sendMail.setAction(Intent.ACTION_SEND);
    sendMail.setType("plain/text");
    sendMail.putExtra(Intent.EXTRA_EMAIL, recipients);
    sendMail.putExtra(Intent.EXTRA_SUBJECT, getText(R.string.ime_crashed_title));
    sendMail.putExtra(Intent.EXTRA_TEXT, mCrashReportDetails.crashReportText);

    try {//  ww  w .  j  a va  2  s.com
        Intent sender = Intent.createChooser(sendMail, getString(R.string.ime_crashed_intent_selector_title));
        sender.putExtra(Intent.EXTRA_EMAIL, sendMail.getStringArrayExtra(Intent.EXTRA_EMAIL));
        sender.putExtra(Intent.EXTRA_SUBJECT, sendMail.getStringExtra(Intent.EXTRA_SUBJECT));
        sender.putExtra(Intent.EXTRA_TEXT, mCrashReportDetails.crashReportText);

        Logger.i(TAG, "Will send crash report using " + sender);
        startActivity(sender);
    } catch (android.content.ActivityNotFoundException ex) {
        Toast.makeText(getApplicationContext(), "Unable to send bug report via e-mail!", Toast.LENGTH_LONG)
                .show();
    }

    finish();
}

From source file:org.kontalk.service.ServerListUpdater.java

@Override
public void onReceive(Context context, Intent intent) {
    String action = intent.getAction();

    if (MessageCenterService.ACTION_CONNECTED.equals(action)) {
        // request serverlist
        MessageCenterService.requestServerList(mContext);
    }/* w  w w .  ja  v a 2s  .c o  m*/

    else if (MessageCenterService.ACTION_SERVERLIST.equals(action)) {
        // we don't need this any more
        unregisterReceiver();

        String[] items = intent.getStringArrayExtra(MessageCenterService.EXTRA_JIDLIST);
        if (items != null && items.length > 0) {
            String network = intent.getStringExtra(MessageCenterService.EXTRA_FROM);
            Properties prop = new Properties();
            Date now = new Date();
            ServerList list = new ServerList(now);
            prop.setProperty("timestamp", sTimestampFormat.format(now));

            for (int i = 0; i < items.length; i++) {
                String item = network + '|' + items[i];
                prop.setProperty("server" + (i + 1), item);
                list.add(new EndpointServer(item));
            }

            OutputStream out = null;
            try {
                out = new FileOutputStream(getCachedListFile(mContext));
                prop.store(out, null);
                out.close();

                // update cached list
                sCurrentList = list;

                if (mListener != null)
                    mListener.updated(list);
            } catch (IOException e) {
                if (mListener != null)
                    mListener.error(e);
            } finally {
                try {
                    out.close();
                } catch (Exception e) {
                    // ignored
                }
            }
        }

        else {
            if (mListener != null)
                mListener.error(null);
        }
    }
}

From source file:org.mariotaku.twidere.activity.FileSelectorActivity.java

private void showPickFileDialog() {
    final Intent intent = getIntent();
    final Uri data = intent.getData();
    final String action = intent.getAction();
    File initialDirectory = data != null ? new File(data.getPath()) : getExternalStorageDirectory();
    if (initialDirectory == null) {
        initialDirectory = new File("/");
    }// w ww . j ava  2 s .c  o m
    final FileSelectorDialogFragment f = new FileSelectorDialogFragment();
    final Bundle args = new Bundle();
    args.putString(EXTRA_ACTION, action);
    args.putString(EXTRA_PATH, initialDirectory.getAbsolutePath());
    args.putStringArray(EXTRA_FILE_EXTENSIONS, intent.getStringArrayExtra(EXTRA_FILE_EXTENSIONS));
    f.setArguments(args);
    f.show(getSupportFragmentManager(), "select_file");
}

From source file:com.josecarlos.couplecounters.MainActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {

    Log.i("CC", "Entered onActivityResult()");

    if (requestCode == LOGIN_REQUEST && resultCode == RESULT_OK) {
        currentPartner1 = data.getStringExtra("partner1");
        currentPartner2 = data.getStringExtra("partner2");
        namePartner1 = data.getStringExtra("name1");
        namePartner2 = data.getStringExtra("name2");
        Log.i("CC", currentPartner1 + " " + currentPartner2);
        String[] countersName = data.getStringArrayExtra("countersName");
        String[] countersType = data.getStringArrayExtra("countersType");
        for (int i = 0; i < countersName.length; i++) {
            Log.i("CC", countersName[i]);
            listAdapter.add(new CounterItem(countersName[i], "1".equals(countersType[i])));
        }/*from  w ww  .  j a  va2s .  com*/
    } else if (requestCode == COUNTER_REQUEST && resultCode == RESULT_OK) {
        String newCounter = data.getStringExtra("counter");
        String commonCounter = data.getStringExtra("common");
        listAdapter.add(new CounterItem(newCounter, "1".equals(commonCounter)));
    }

    else if (requestCode == EDIT_REQUEST && resultCode == RESULT_OK) {
        CounterItem item = listAdapter.getItem(currentCounter);
        item.setCounterName(data.getStringExtra("counter"));
        listAdapter.set(currentCounter, item);
    }

}

From source file:com.googlecode.android_scripting.activity.ApiBrowser.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    RequestCode request = RequestCode.values()[requestCode];
    if (resultCode == RESULT_OK) {
        switch (request) {
        case RPC_PROMPT:
            MethodDescriptor rpc = FacadeConfiguration
                    .getMethodDescriptor(data.getStringExtra(Constants.EXTRA_API_PROMPT_RPC_NAME));
            String[] values = data.getStringArrayExtra(Constants.EXTRA_API_PROMPT_VALUES);
            insertText(rpc, values);/*from  w w w  .  j ava 2s  .c  o m*/
            break;
        default:
            break;
        }
    } else {
        switch (request) {
        case RPC_PROMPT:
            break;
        default:
            break;
        }
    }
}

From source file:com.silentcircle.contacts.quickcontact.QuickContactActivity.java

@Override
protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB_MR1) {
        Log.i(TAG, "QuickContact only available for API >= HONEYCOMB_MR1");
        finish();/*www. ja  va  2s  . c o  m*/
        return;
    }

    if (TRACE_LAUNCH)
        android.os.Debug.startMethodTracing(TRACE_TAG);

    // Parse intent
    final Intent intent = getIntent();

    Uri lookupUri = intent.getData();

    mLookupUri = Preconditions.checkNotNull(lookupUri, "missing lookupUri");

    mExcludeMimes = intent.getStringArrayExtra(QuickContact.EXTRA_EXCLUDE_MIMES);

    mContactLoader = (ContactLoader) getSupportLoaderManager().initLoader(LOADER_ID, null, mLoaderCallbacks);

    // Show QuickContact in front of soft input
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
            WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);

    setContentView(R.layout.quickcontact_activity);

    mFloatingLayout = (FloatingChildLayout) findViewById(R.id.floating_layout);
    mTrack = (ViewGroup) findViewById(R.id.track);
    mTrackScroller = (HorizontalScrollView) findViewById(R.id.track_scroller);
    mOpenDetailsImage = (ImageView) findViewById(R.id.contact_details_image);
    mOpenDetailsPushLayerButton = (ImageButton) findViewById(R.id.open_details_push_layer);
    mListPager = (ViewPager) findViewById(R.id.item_list_pager);
    mSelectedTabRectangle = findViewById(R.id.selected_tab_rectangle);
    mLineAfterTrack = findViewById(R.id.line_after_track);

    mFloatingLayout.setOnOutsideTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            handleOutsideTouch();
            return true;
        }
    });

    final OnClickListener openDetailsClickHandler = new OnClickListener() {
        @Override
        public void onClick(View v) {
            final Intent intent = new Intent(Intent.ACTION_VIEW, mLookupUri);
            mContactLoader.cacheResult();
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
            startActivity(intent);
            close(false);
        }
    };
    mOpenDetailsPushLayerButton.setOnClickListener(openDetailsClickHandler);
    mListPager.setAdapter(new ViewPagerAdapter(getSupportFragmentManager()));
    mListPager.setOnPageChangeListener(new PageChangeListener());

    final Rect sourceBounds = intent.getSourceBounds();
    if (sourceBounds != null) {
        mFloatingLayout.setChildTargetScreen(sourceBounds);
    }

    // find and prepare correct header view
    mPhotoContainer = findViewById(R.id.photo_container);
    setHeaderNameText(R.id.name, R.string.missing_name);

    SchedulingUtils.doAfterLayout(mFloatingLayout, new Runnable() {
        @Override
        public void run() {
            mFloatingLayout.fadeInBackground();
        }
    });
}

From source file:de.vanita5.twittnuker.activity.support.FileSelectorActivity.java

@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final Intent intent = getIntent();
    final Uri data = intent.getData();
    File initialDirectory = data != null ? new File(data.getPath()) : getExternalStorageDirectory();
    if (initialDirectory == null) {
        initialDirectory = new File("/");
    }/*from  w ww  .ja v  a  2 s .  com*/
    final String action = intent.getAction();
    if (!INTENT_ACTION_PICK_FILE.equals(action) && !INTENT_ACTION_PICK_DIRECTORY.equals(action)) {
        finish();
        return;
    }
    final FileSelectorDialogFragment f = new FileSelectorDialogFragment();
    final Bundle args = new Bundle();
    args.putString(EXTRA_ACTION, action);
    args.putString(EXTRA_PATH, initialDirectory.getAbsolutePath());
    args.putStringArray(EXTRA_FILE_EXTENSIONS, intent.getStringArrayExtra(EXTRA_FILE_EXTENSIONS));
    f.setArguments(args);
    f.show(getSupportFragmentManager(), "select_file");
}

From source file:org.getlantern.firetweet.activity.support.FileSelectorActivity.java

@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final Intent intent = getIntent();
    final Uri data = intent.getData();
    File initialDirectory = data != null ? new File(data.getPath()) : getExternalStorageDirectory();
    if (initialDirectory == null) {
        initialDirectory = new File("/");
    }/*from www  .java  2s  .  c  o  m*/
    final String action = intent.getAction();
    if (!INTENT_ACTION_PICK_FILE.equals(action) && !INTENT_ACTION_PICK_DIRECTORY.equals(action)) {
        finish();
        return;
    }

    final FileSelectorDialogFragment f = new FileSelectorDialogFragment();
    final Bundle args = new Bundle();
    args.putString(EXTRA_ACTION, action);
    args.putString(EXTRA_PATH, initialDirectory.getAbsolutePath());
    args.putStringArray(EXTRA_FILE_EXTENSIONS, intent.getStringArrayExtra(EXTRA_FILE_EXTENSIONS));
    f.setArguments(args);
    f.show(getSupportFragmentManager(), "select_file");
}