Example #1
1
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == 1 && resultCode == RESULT_OK && data != null) {
      Uri selectedImage = data.getData();
      String[] filePath = {MediaStore.Images.Media.DATA};

      Cursor cursor = getContentResolver().query(selectedImage, filePath, null, null, null);
      cursor.moveToFirst();

      int columnIndex = cursor.getColumnIndex(filePath[0]);
      String picturePath = cursor.getString(columnIndex);
      cursor.close();

      ImageView image = (ImageView) findViewById(R.id.imageView2);
      image.setImageBitmap(BitmapFactory.decodeFile(picturePath));
      imagepath = picturePath;
    } else if (requestCode == 2 && resultCode == RESULT_OK) {
      Bitmap photo = (Bitmap) data.getExtras().get("data");
      ImageView image = (ImageView) findViewById(R.id.imageView2);
      image.setImageBitmap(photo);
      try {
        File imagefile = createImageFile(photo);
        Log.d("dir", imagefile.getAbsolutePath());
        imagepath = imagefile.getAbsolutePath();
      } catch (IOException e) {
        e.printStackTrace();
      }
    }
  }
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
    switch (requestCode) {
      case REQUEST_CODE_PUBLIC_KEYS:
        {
          if (resultCode == Activity.RESULT_OK) {
            Bundle bundle = data.getExtras();
            setEncryptionKeyIds(
                bundle.getLongArray(SelectPublicKeyActivity.RESULT_EXTRA_MASTER_KEY_IDS));
          }
          break;
        }

      case REQUEST_CODE_SECRET_KEYS:
        {
          if (resultCode == Activity.RESULT_OK) {
            Uri uriMasterKey = data.getData();
            setSignatureKeyId(Long.valueOf(uriMasterKey.getLastPathSegment()));
          } else {
            setSignatureKeyId(Constants.key.none);
          }
          break;
        }

      default:
        {
          super.onActivityResult(requestCode, resultCode, data);

          break;
        }
    }
  }
  @Override
  public void onReceive(Context context, Intent intent) {
    String intentAction = intent.getAction();
    if (Intent.ACTION_MEDIA_BUTTON.equals(intentAction)) {
      KeyEvent event = (KeyEvent) intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT);

      if (event == null) {
        return;
      }

      int keycode = event.getKeyCode();
      if (firstElapsed == -1) {
        firstElapsed = System.currentTimeMillis();
        count = 0;
      }
      currentElapsed = System.currentTimeMillis();
      long duration = currentElapsed - firstElapsed;
      if (duration > 0 && duration < MAX_DELAY && keycode == KeyEvent.KEYCODE_HEADSETHOOK) count++;
      if (duration > MAX_DELAY) {
        firstElapsed = -1;
        count = 0;
      }
      Log.d("EVENT", "" + keycode + " " + count);
      if (count == 3) {
        StandOutWindow.show(context, LockScreenNowService.class, StandOutWindow.DEFAULT_ID);
        count = 0;
        firstElapsed = -1;
      }
    }
  }
Example #4
1
File: ax.java Project: ZoneMo/test
 public final void onClick(View paramView) {
   m.dZN.j(10108, "1");
   Intent localIntent = new Intent(this.gZI.aal(), SelectContactUI.class);
   localIntent.putExtra("Contact_GroupFilter_Type", "@micromsg.qq.com");
   localIntent.putExtra("List_Type", 0);
   this.gZI.aal().startActivity(localIntent);
 }
 protected void onStart() {
   super.onStart();
   this.a.updateHeader(
       "No current file!",
       R.string.pref_hardware_config_filename,
       R.id.active_filename,
       R.id.included_header);
   Intent intent = this.getIntent();
   Serializable serializable =
       intent.getSerializableExtra("Edit Servo ControllerConfiguration Activity");
   if (serializable != null) {
     this.b = (ServoControllerConfiguration) serializable;
     this.c = (ArrayList) this.b.getServos();
   }
   this.d.setText((CharSequence) this.b.getName());
   TextView textView = (TextView) this.findViewById(R.id.servo_controller_serialNumber);
   String string = this.b.getSerialNumber().toString();
   if (string.equalsIgnoreCase(ControllerConfiguration.NO_SERIAL_NUMBER.toString())) {
     string = "No serial number";
   }
   textView.setText((CharSequence) string);
   for (int i = 0; i < this.c.size(); ++i) {
     this.c(i + 1);
     this.a(i + 1);
     this.b(i + 1);
   }
 }
 private void fillData() {
   newName.setText(intent.getStringExtra(NutrientsDBAdapter.KEY_NAME));
   newProteins.setText(String.valueOf(intent.getFloatExtra(NutrientsDBAdapter.KEY_PROTEINS, 0)));
   newFats.setText(String.valueOf(intent.getFloatExtra(NutrientsDBAdapter.KEY_FATS, 0)));
   newCarbs.setText(String.valueOf(intent.getFloatExtra(NutrientsDBAdapter.KEY_CARBOHYDRATES, 0)));
   newCalories.setText(String.valueOf(intent.getFloatExtra(NutrientsDBAdapter.KEY_CALORIES, 0)));
 }
        @Override
        public void onReceive(Context context, Intent intent) {
          if (intent.getAction().equals(ACTION_CANCEL_DOWNLOAD)) {
            String url = intent.getStringExtra(EXTRA_DOWNLOAD_URL);
            if (url == null) {
              throw new IllegalArgumentException(
                  "ACTION_CANCEL_DOWNLOAD intent needs download url extra");
            }
            if (AppConfig.DEBUG) Log.d(TAG, "Cancelling download with url " + url);
            Downloader d = getDownloader(url);
            if (d != null) {
              d.cancel();
            } else {
              Log.e(TAG, "Could not cancel download with url " + url);
            }

          } else if (intent.getAction().equals(ACTION_CANCEL_ALL_DOWNLOADS)) {
            for (Downloader d : downloads) {
              d.cancel();
              if (AppConfig.DEBUG) Log.d(TAG, "Cancelled all downloads");
            }
            sendBroadcast(new Intent(ACTION_DOWNLOADS_CONTENT_CHANGED));
          }
          queryDownloads();
        }
 @TargetApi(11)
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   switch (item.getItemId()) {
     case R.id.menu_item_new_crime:
       Crime crime = new Crime();
       CrimeLab.get(getActivity()).addCrime(crime);
       Intent i = new Intent(getActivity(), CrimeActivity.class);
       i.putExtra(CrimeFragment.EXTRA_CRIME_ID, crime.getId());
       startActivityForResult(i, 0);
       return true;
     case R.id.menu_item_show_subtitle:
       if (getActivity().getActionBar().getSubtitle() == null) {
         getActivity().getActionBar().setSubtitle(R.string.subtitle);
         mSubtitleVisible = true;
         item.setTitle(R.string.hide_subtitle);
       } else {
         getActivity().getActionBar().setSubtitle(null);
         mSubtitleVisible = false;
         item.setTitle(R.string.show_subtitle);
       }
       return true;
     default:
       return super.onOptionsItemSelected(item);
   }
 }
Example #9
0
  public static void postIModNotification(Context context) {
    NotificationManagerCompat nm = NotificationManagerCompat.from(context);
    if (!MLPreferences.getPrefsApps(context)
        .getBoolean(Common.SHOW_IMOD_RESET_NOTIFICATION, false)) {
      nm.cancel(IMOD_NOTIFICATION_ID);
      return;
    }
    Intent notifyIntent = new Intent(context, ActionActivity.class);
    notifyIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
    notifyIntent.putExtra(ActionsHelper.ACTION_EXTRA_KEY, R.id.radio_imod_reset);

    NotificationCompat.Builder builder =
        new NotificationCompat.Builder(context)
            .setContentTitle(context.getString(R.string.action_imod_reset))
            .setContentText("")
            .setSmallIcon(R.drawable.ic_apps_24dp)
            .setContentIntent(
                PendingIntent.getActivity(
                    context.getApplicationContext(),
                    0,
                    notifyIntent,
                    PendingIntent.FLAG_UPDATE_CURRENT))
            .setOngoing(true)
            .setAutoCancel(true);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
      builder.setShowWhen(false);
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
      builder
          .setPriority(NotificationCompat.PRIORITY_MIN)
          .setCategory(NotificationCompat.CATEGORY_STATUS)
          .setColor(ContextCompat.getColor(context, R.color.accent));
    }
    nm.notify(IMOD_NOTIFICATION_ID, builder.build());
  }
Example #10
0
 public void showText(String filename) {
   Intent showIt = new Intent(this, TipsAndTricksShowTextView.class);
   Bundle toShow = new Bundle();
   toShow.putString("tat_show_file", filename);
   showIt.putExtras(toShow);
   startActivity(showIt);
 }
Example #11
0
  public void rescheduleFacebookUser(boolean force) {
    AlarmManager alarmMgr = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE);
    long nexttime;

    long current_time = System.currentTimeMillis();
    long last_update_time = orm.getLastUpdateFriendTime();
    long donespan = (current_time - last_update_time);
    long left_time = getFriendsTimeout() * 1000L - donespan;
    if (donespan < 0 || left_time <= 0) {
      long waittime = 1;
      for (int i = 0; i < nErrorCount && i < 10; i++) {
        waittime = waittime * 2;
      }
      nexttime = System.currentTimeMillis() + 10 * 1000 * waittime;
    } else {
      nexttime = System.currentTimeMillis() + left_time;
    }

    if (force == true) {
      nexttime = System.currentTimeMillis() + 10 * 1000;
    }

    if (SNSService.TEST_LOOP) {
      nexttime = System.currentTimeMillis() + 90 * 1000;
    }

    Intent i = new Intent();
    i.setClassName("com.ast.free", "com.ast.free.service.SNSService");
    i.setAction("com.ast.free.intent.action.FACEBOOK_USER");
    PendingIntent userpi =
        PendingIntent.getService(
            mContext.getApplicationContext(), 0, i, PendingIntent.FLAG_CANCEL_CURRENT);
    alarmMgr.set(AlarmManager.RTC_WAKEUP, nexttime, userpi);
  }
Example #12
0
 public void onReceive(Context context, Intent intent) {
   String action = intent.getAction();
   // Slog.d(TAG, "received " + action);
   if (Intent.ACTION_BOOT_COMPLETED.equals(action)) {
     int userId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, UserHandle.USER_NULL);
     if (userId >= 0) {
       getImplForUser(userId).sendInitialBroadcasts();
     } else {
       Slog.w(TAG, "Incorrect user handle supplied in " + intent);
     }
   } else if (Intent.ACTION_CONFIGURATION_CHANGED.equals(action)) {
     for (int i = 0; i < mAppWidgetServices.size(); i++) {
       AppWidgetServiceImpl service = mAppWidgetServices.valueAt(i);
       service.onConfigurationChanged();
     }
   } else {
     int sendingUser = getSendingUserId();
     if (sendingUser == UserHandle.USER_ALL) {
       for (int i = 0; i < mAppWidgetServices.size(); i++) {
         AppWidgetServiceImpl service = mAppWidgetServices.valueAt(i);
         service.onBroadcastReceived(intent);
       }
     } else {
       AppWidgetServiceImpl service = mAppWidgetServices.get(sendingUser);
       if (service != null) {
         service.onBroadcastReceived(intent);
       }
     }
   }
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Creates the window used for the UI
    setContentView(R.layout.activity_stock_info);

    // Get the message from the intent that has the stock symbol
    Intent intent = getIntent();
    String stockSymbol = intent.getStringExtra(MainActivity.STOCK_SYMBOL);

    // Initialize TextViews
    companyNameTextView = (TextView) findViewById(R.id.companyNameTextView);
    yearLowTextView = (TextView) findViewById(R.id.yearLowTextView);
    yearHighTextView = (TextView) findViewById(R.id.yearHighTextView);
    daysLowTextView = (TextView) findViewById(R.id.daysLowTextView);
    daysHighTextView = (TextView) findViewById(R.id.daysHighTextView);
    lastTradePriceOnlyTextView = (TextView) findViewById(R.id.lastTradePriceOnlyTextView);
    changeTextView = (TextView) findViewById(R.id.changeTextView);
    daysRangeTextView = (TextView) findViewById(R.id.daysRangeTextView);

    // Sends a message to the LogCat
    Log.d(TAG, "Before URL Creation " + stockSymbol);

    // Create the YQL query
    final String yqlURL = yahooURLFirst + stockSymbol + yahooURLSecond;

    // The Android UI toolkit is not thread safe and must always be
    // manipulated on the UI thread. This means if I want to perform
    // any network operations like grabbing xml data, I have to do it
    // in its own thread. The problem is that you can't write to the
    // GUI from outside the main activity. AsyncTask solves those problems

    new MyAsyncTask().execute(yqlURL);
  }
Example #14
0
 public void Alarm(View view) {
   String str = "Long Jumping (Girls)";
   Intent it = new Intent("android.intent.action.SETNOTIFICATION");
   it.putExtra("event", str);
   it.putExtra("address", "android.intent.action.LONGJUMPINGGIRLS");
   startActivity(it);
 }
 public void onChannelSelected(long paramLong, String paramString) {
   Intent localIntent = new Intent();
   localIntent.putExtra("channel", paramString);
   localIntent.putExtra("channel_id", paramLong);
   setResult(-1, localIntent);
   finish();
 }
  @Override
  public void onClick(View v) {
    if (entry == null) {
      return;
    }

    switch (entry.getState()) {
      case ThemeEntry.STATE_UNINSTALLED:
        Uri uri = Uri.parse("market://search?q=pname:" + entry.getPackageName());
        Intent intent = new Intent(Intent.ACTION_VIEW, uri);
        try {
          v.getContext().startActivity(intent);
        } catch (ActivityNotFoundException e) {
          uri = Uri.parse(entry.getFileUrl());
          intent.setData(uri);
          v.getContext().startActivity(intent);
        }
        break;
      case ThemeEntry.STATE_INSTALLED:
        useTheme(v.getContext());
        break;
      case ThemeEntry.STATE_USING:
        break;
    }
  }
  // TODO: if uploadingComplete() when activity backgrounded, won't work.
  public void uploadingComplete(ArrayList<String> result) {

    int resultSize = result.size();
    boolean success = false;
    if (resultSize == totalCount) {
      Toast.makeText(
              this, getString(R.string.upload_all_successful, totalCount), Toast.LENGTH_SHORT)
          .show();

      success = true;
    } else {
      String s = totalCount - resultSize + " of " + totalCount;
      Toast.makeText(this, getString(R.string.upload_some_failed, s), Toast.LENGTH_LONG).show();
    }

    Intent in = new Intent();
    in.putExtra(GlobalConstants.KEY_SUCCESS, success);
    setResult(RESULT_OK, in);

    // for each path, update the status
    FileDbAdapter fda = new FileDbAdapter(this);
    fda.open();
    for (int i = 0; i < resultSize; i++) {
      Cursor c = fda.fetchFilesByPath(result.get(i), null);
      if (c != null) {
        if (c.getString(c.getColumnIndex(FileDbAdapter.KEY_STATUS))
            .equals(FileDbAdapter.STATUS_COMPLETED))
          fda.updateFile(result.get(i), FileDbAdapter.STATUS_SUBMITTED, null);
      }
    }
    fda.close();
    finish();
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // get instances to upload
    Intent i = getIntent();
    ArrayList<String> instances = i.getStringArrayListExtra(GlobalConstants.KEY_INSTANCES);
    if (instances == null) {
      // nothing to upload
      return;
    }

    SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
    String url = settings.getString(UserPreferences.KEY_SERVER, getString(R.string.default_server));
    String authCredentials =
        settings.getString(UserPreferences.KEY_USERNAME, getString(R.string.username))
            + ":"
            + settings.getString(UserPreferences.KEY_PASSWORD, getString(R.string.password));

    mInstanceUploaderTask = (InstanceUploaderTask) getLastNonConfigurationInstance();
    if (mInstanceUploaderTask == null) {

      // setup dialog and upload task
      showDialog(PROGRESS_DIALOG);
      mInstanceUploaderTask = new InstanceUploaderTask();
      mInstanceUploaderTask.setUploadServer(url + "/fileUpload?");
      mInstanceUploaderTask.setAuthCredentials(authCredentials);
      totalCount = instances.size();

      // convert array list to an array
      String[] sa = instances.toArray(new String[totalCount]);
      mInstanceUploaderTask.execute(sa);
    }
  }
 private void initializeValidAllocatableCategory() {
   Intent i = new Intent();
   i.putExtra("allocationCategory", VALID_ALLOCATABLE_CATEGORY_ID);
   i.putExtra(
       AllocatableDetailsActivity.INTENT_STRING_ALLOCATABLE_CATEGORY_ELEMENT_KEY, "default");
   this.setActivityIntent(i);
 }
Example #20
0
  public void alarmFacebookUserComming(Message callbackMessage) {
    Log.d(TAG, "alarmFacebookUserComming");

    Message msg = handler.obtainMessage(FACEBOOK_FRIENDS_GET);
    if (callbackMessage != null) {
      msg.getData().putParcelable(CALLBACK, callbackMessage);
      msg.getData().putLong("hisuid", callbackMessage.getData().getLong("hisuid", -1));
    }
    handler.sendMessageDelayed(msg, 1 * 1000);

    long nexttime = System.currentTimeMillis() + getFriendsTimeout() * 1000L;

    if (SNSService.TEST_LOOP) {
      nexttime = System.currentTimeMillis() + 90 * 1000;
    }

    AlarmManager alarmMgr = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE);

    Intent i = new Intent();
    i.setClassName("com.ast.free", "com.ast.free.service.SNSService");
    i.setAction("com.ast.free.intent.action.FACEBOOK_USER");
    PendingIntent userpi =
        PendingIntent.getService(
            mContext.getApplicationContext(), 0, i, PendingIntent.FLAG_CANCEL_CURRENT);
    alarmMgr.set(AlarmManager.RTC_WAKEUP, nexttime, userpi);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);
    getSupportActionBar().setBackgroundDrawable(new ColorDrawable(0xff359AC4));

    TextView textView_id = (TextView) findViewById(R.id.profile_id);
    TextView textView_pw = (TextView) findViewById(R.id.profile_pw);

    Intent intent_main = getIntent();

    String id = intent_main.getStringExtra("id");
    String pw = intent_main.getStringExtra("password");

    textView_id.setText(String.valueOf(id));
    textView_pw.setText(String.valueOf(pw));

    mNavigationDrawerFragment =
        (NavigationDrawerFragment)
            getSupportFragmentManager().findFragmentById(R.id.navigation_drawer);
    mTitle = getTitle();

    // Set up the drawer.
    mNavigationDrawerFragment.setUp(
        R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout));
  }
  /**
   * Set up English voice search button in the widget
   *
   * @param context
   * @param remoteView
   */
  private void setupEnglishVoiceSearch(Context context, RemoteViews remoteView) {
    if (Device.DEVICE_TYPE.equals(Device.DeviceType.Google_TV)) {
      remoteView.setViewVisibility(R.id.eng_voice, View.INVISIBLE);
    } else {
      // ---this intent points to activity that should handle results---
      Intent activityIntent2 = new Intent(_actionVoiceSearch);
      PendingIntent resultsPendingIntent2 =
          PendingIntent.getService(context, 0, activityIntent2, 0);

      // ---this intent calls the English voice recognition---
      Intent englishVoiceIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
      englishVoiceIntent.putExtra(
          RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
      englishVoiceIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 2);
      englishVoiceIntent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Speak your search");
      englishVoiceIntent.putExtra(
          RecognizerIntent.EXTRA_RESULTS_PENDINGINTENT, resultsPendingIntent2);

      // ---wraps speech recognition intent---
      PendingIntent englishPendingIntent =
          PendingIntent.getActivity(
              context,
              randomGenerator.nextInt(100),
              englishVoiceIntent,
              PendingIntent.FLAG_CANCEL_CURRENT);
      remoteView.setOnClickPendingIntent(R.id.eng_voice, englishPendingIntent);
    }
  }
  @Override
  public int onStartCommand(Intent intent, int flags, int startId) {
    DebugLogging.log(
        getApplicationContext(),
        (LOG_TAG
            + " onStartCommand handlerIsCreated "
            + handlerIsCreated
            + " "
            + (intent == null)));
    if ((intent != null)
        && (intent.getAction() != null)
        && (intent.getAction().equals(INSERT_DATA_ACTION))) {
      if (handlerIsCreated) {
        Message msg = thread.getHandler().obtainMessage();
        msg.arg1 = startId;

        msg.what = INSERT_DATA;
        msg.obj = intent.getExtras();
        thread.getHandler().sendMessage(msg);
      } else {
        needToSaveTransaction = true;
        bundle = intent.getExtras();
      }
    }

    return START_STICKY;
  }
  @Override
  public void onReceive(Context context, Intent intent) {
    if (mCustomEventInterstitialListener == null) {
      return;
    }

    /**
     * Only consume this broadcast if the identifier on the received Intent and this broadcast match
     * up. This allows us to target broadcasts to the ad that spawned them. We include this here
     * because there is no appropriate IntentFilter condition that can recreate this behavior.
     */
    final long receivedIdentifier = intent.getLongExtra(BROADCAST_IDENTIFIER_KEY, -1);
    if (mBroadcastIdentifier != receivedIdentifier) {
      return;
    }

    final String action = intent.getAction();
    if (ACTION_INTERSTITIAL_FAIL.equals(action)) {
      mCustomEventInterstitialListener.onInterstitialFailed(NETWORK_INVALID_STATE);
    } else if (ACTION_INTERSTITIAL_SHOW.equals(action)) {
      mCustomEventInterstitialListener.onInterstitialShown();
    } else if (ACTION_INTERSTITIAL_DISMISS.equals(action)) {
      mCustomEventInterstitialListener.onInterstitialDismissed();
      unregister();
    } else if (ACTION_INTERSTITIAL_CLICK.equals(action)) {
      mCustomEventInterstitialListener.onInterstitialClicked();
    }
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_daily_forecast);
    ButterKnife.bind(this);

    Intent intent = getIntent();

    mLocation = intent.getStringExtra(getString(R.string.location_name));
    Parcelable[] parcelables = intent.getParcelableArrayExtra(MainActivity.DAILY_FORECAST);
    mDays = Arrays.copyOf(parcelables, parcelables.length, Day[].class);

    mLocationLabel.setText(String.valueOf(mLocation));

    DayAdapter adapter = new DayAdapter(this, mDays);
    mListView.setAdapter(adapter);
    mListView.setEmptyView(mEmptyTextView);
    mListView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

            String dayOfTheWeek = mDays[position].getDayOfTheWeek();
            String conditions = mDays[position].getSummary();
            String highTemp = mDays[position].getTemperatureMax() + "";
            String lowTemp = mDays[position].getTemperatureMin() + "";
            String message =
                String.format(
                    "%s - High: %s, Low: %s, and %s", dayOfTheWeek, highTemp, lowTemp, conditions);
            Toast.makeText(DailyForecastActivity.this, message, Toast.LENGTH_LONG).show();
          }
        });
  }
Example #26
0
  @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == FILE_CODE && resultCode == Activity.RESULT_OK) {
      if (data.getBooleanExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false)) {
        // For JellyBean and above
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
          ClipData clip = data.getClipData();

          if (clip != null) {
            for (int i = 0; i < clip.getItemCount(); i++) {
              Uri uri = clip.getItemAt(i).getUri();
              uploadFile(uri.getPath());
            }
          }
        } else {
          ArrayList<String> paths = data.getStringArrayListExtra(FilePickerActivity.EXTRA_PATHS);

          if (paths != null) {
            for (String path : paths) {
              Uri uri = Uri.parse(path);
              uploadFile(uri.getPath());
            }
          }
        }

      } else {
        Uri uri = data.getData();
        uploadFile(uri.getPath());
      }
    }
  }
 /**
  * Device Connectにイベントを送信する.
  *
  * @param event イベントパラメータ
  * @param bundle パラメータ
  * @return 送信成功の場合true、アクセストークンエラーの場合はfalseを返す。
  */
 public final boolean sendEvent(final Event event, final Bundle bundle) {
   Intent intent = EventManager.createEventMessage(event);
   Bundle original = intent.getExtras();
   original.putAll(bundle);
   intent.putExtras(original);
   return sendEvent(intent, event.getAccessToken());
 }
 public void btnCallUsClicked(View view) {
   // open dialer and pass their number
   String novMaxNumber = "+447540595289";
   Intent i = new Intent(Intent.ACTION_CALL);
   i.setData(Uri.parse("tel:" + novMaxNumber));
   startActivity(i);
 }
  public void onCreate(Bundle bundle) {
    super.onCreate(bundle);

    setContentView(R.layout.activity_main);

    Intent intent = getIntent();
    ciudad = intent.getStringExtra("Ciudad");
    Toast.makeText(this, ciudad + " selected", Toast.LENGTH_LONG).show();

    nomb_ciudad = (TextView) findViewById(R.id.nomb_ciudad);
    nomb_ciudad.setText(ciudad);

    min = (TextView) findViewById(R.id.temp_minima);
    max = (TextView) findViewById(R.id.temp_maxima);
    actual = (TextView) findViewById(R.id.temp_actual);

    new HttpGetTask().execute();

    /*actualizar = (Button) findViewById(R.id.btn_actualizar);


    actualizar.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            new HttpGetTask().execute();
        }
    });*/

  }
 @Override
 public void onInfoWindowClick(Marker marker) {
   if (marker.getTitle().equals(getString(R.string.Marker_NotRegistered))) {
     // 未登録のマーカーであれば情報を追加する
     // 地点情報追加画面に遷移
     Intent intent = new Intent(this, AddPlaceActivity.class);
     intent.putExtra("latitude", marker.getPosition().latitude);
     intent.putExtra("longitude", marker.getPosition().longitude);
     startActivityForResult(intent, 123);
   }
   PlaceInfo pInfo = new PlaceInfo();
   pInfo.mMarker = marker;
   if (mPlaceInfoList.contains(pInfo)) {
     // マーカーの詳細情報画面を開く
     Intent intent = new Intent(this, DisplayDetailActivity.class);
     PlaceInfo pClone = mPlaceInfoList.get(mPlaceInfoList.indexOf(pInfo)).getSeralizable();
     intent.putExtra("placeInfo", pClone);
     try {
       startActivity(intent);
     } catch (RuntimeException e) {
       Toast t = Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG);
       t.show();
       e.getStackTrace();
     }
   }
 }