@Override protected void onListItemClick(ListView l, View v, int position, long id) { RssItem item = rssList.get(position); Intent intent = new Intent(RssReaderActivity.this, RssDetailActivity.class); intent.putExtra("rss_title", item.getTitle()); intent.putExtra("rss_link", item.getLink()); RssReaderActivity.this.startActivity(intent); }
private static Intent setUpIntent() { Intent command = new Intent(context, ProviderAPI.class); command.setAction(action); command.putExtra(ProviderAPI.PARAMETERS, parameters); command.putExtra(ProviderAPI.RECEIVER_KEY, result_receiver); return command; }
public void run() { int timedCount = 0; while (!Thread.interrupted()) { try { Thread.sleep(SEC_POLL_DELAY); } catch (InterruptedException e) { break; } // 5400 seconds = 90 min if (timedCount == 5400) { timedCount = 0; Intent dialogIntent = new Intent(getBaseContext(), BlockerActivity.class); dialogIntent.addFlags( Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); dialogIntent.putExtra( "AlertInfo", "You've used your phone for 90 minutes NON-STOP. Please take a break!"); getApplication().startActivity(dialogIntent); } timedCount++; synchronized (mPauseLock) { while (mPaused) { try { mPauseLock.wait(); } catch (InterruptedException e) { e.printStackTrace(); } } } } }
void acctSelected(ServiceAcctInfo info) { Account acct = new Account(); acct.name = info.desc; acct.service = info; DialogInterface.OnClickListener emptyClickListener = new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) {} }; AcctTables db = new AcctTables(this); try { db.openWritable(); try { db.pushAccount(acct); } catch (SQLiteException e) { AlertDialog dlg = Utilities.buildAlert( this, e, "Unable to add account", "Internal Error", emptyClickListener); dlg.show(); return; } } finally { db.close(); } Intent i = getIntent(); i.putExtra("acct_id", acct.ID); setResult(RESULT_OK, i); finish(); }
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); incoming = (TextView) findViewById(R.id.incoming); btnPush = (Button) findViewById(R.id.btn_push); Intent intent = new Intent(WebSocketService.START_TEAM_GAME_SERVICE_INTENT); intent.putExtra("url", "ws://192.168.38.12:8081"); // startService(new Intent(this, WebSocketService.class)); startService(intent); bindService(new Intent(this, WebSocketService.class), connection, Context.BIND_AUTO_CREATE); btnPush.setOnClickListener( new OnClickListener() { @Override public void onClick(View view) { try { Bundle bundle = new Bundle(); bundle.putString("text", "bugoga!"); Message msg = Message.obtain(null, WebSocketService.MSG_SEND_COMMAND); msg.replyTo = messenger; msg.setData(bundle); serviceMessenger.send(msg); } catch (RemoteException e) { e.printStackTrace(); } } }); }
/** * When the back button is pressed, update the MidiOptions. Return the updated options as the * 'result' of this Activity. */ @Override public void onBackPressed() { Intent intent = new Intent(); updateOptions(); intent.putExtra(SettingsActivity.settingsID, options); setResult(Activity.RESULT_OK, intent); super.onBackPressed(); }
public void addEnvToIntent(Intent intent) { Map<String, String> envMap = System.getenv(); Set<Map.Entry<String, String>> envSet = envMap.entrySet(); Iterator<Map.Entry<String, String>> envIter = envSet.iterator(); int c = 0; while (envIter.hasNext()) { Map.Entry<String, String> entry = envIter.next(); intent.putExtra("env" + c, entry.getKey() + "=" + entry.getValue()); c++; } }
/** * Shows <tt>AuthorizationRequestedDialog</tt> for the request with given <tt>id</tt>. * * @param id request identifier for which new dialog will be displayed. */ public static void showDialog(Long id) { Context ctx = JitsiApplication.getGlobalContext(); Intent showIntent = new Intent(ctx, AuthorizationRequestedDialog.class); showIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); showIntent.putExtra(EXTRA_REQUEST_ID, id); ctx.startActivity(showIntent); }
@Override public void onItemClick(AdapterView<?> l, View v, int position, long id) { if (l.getId() == R.id.photosGridView) { String clickedItem = photosGridViewContents[position]; Intent intent = new Intent(PhotoGridActivity.this, PhotoViewerActivity.class); intent.putExtra( "filename", clickedItem); // use putExtra method of Intent here for passing additional information to // PhotoViewerActivity startActivity(intent); } }
private void finishWithPath(String path) { if (pathSettingKey != null && !pathSettingKey.isEmpty()) { SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); SharedPreferences.Editor editor = settings.edit(); editor.putString(pathSettingKey, path); editor.commit(); } Intent intent = new Intent(); intent.putExtra("PATH", path); setResult(RESULT_OK, intent); finish(); }
@Override public void onFinish() { Intent intent; if (mPref.getCheckedTutorial() == true) { // 튜토리얼을 했을 경우 intent = new Intent(AC_Loading.this, AC_Main.class); } else { // 튜토리얼을 안했을 경우 intent = new Intent(AC_Loading.this, AC_Help_tutorial.class); } intent.putExtra("tutorial", true); intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); startActivity(intent); overridePendingTransition(R.anim.fadein, R.anim.fadeout); cTimer.cancel(); finish(); }
public void mOnClickSave(View v) { String inputPath = nowPath; UseDb db = new UseDb(); File files = new File(inputPath); if (files.exists() == true) { db.setValue(this, dbPath, nowPath); Intent intent = new Intent(this, Loading.class); intent.putExtra("path", nowPath); startActivity(intent); finish(); } else { Toast.makeText( FolderEx.this, getResources().getString(R.string.sp_msg_notexistfolder), Toast.LENGTH_SHORT) .show(); } }
void loginFailure() { Intent loginProf = new Intent(this, Login.class); loginProf.putExtra("prof_id", profileId); if (this.session != null) loginProf.putExtra("sess_id", this.session.ID); startActivityForResult(loginProf, GET_SESSION); }