コード例 #1
0
 @Override
 protected void onListItemClick(ListView l, view v, int position, long id) {
     super.onListItemClick(l, v, position, id);
     Toast.makeText(this, data.get(position), Toast.LENGTH_LONG).show();
     data.add("fourth");
     myAdapter.notifyDataSetChanged();
 }
コード例 #2
0
  @Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
    // TODO Auto-generated method stub
    super.onListItemClick(l, v, position, id);
    // Eject dialog
    new AlertDialog.Builder(LossRegister.this)
        .setTitle("确认对话框")
        .setMessage("账户挂失?")
        .setPositiveButton(
            "确认",
            new DialogInterface.OnClickListener() {

              public void onClick(DialogInterface dialog, int which) {
                // delete account turn to account information
                flag = 1; // done
                Toast.makeText(LossRegister.this, "账户挂失成功", Toast.LENGTH_SHORT).show();
                // finish();
              }
            })
        .setNegativeButton(
            "取消",
            new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialog, int which) {
                flag = -1;
                // finish();
              }
            })
        .show();
    if (flag == 1) {
      //			intent.setClass(LossRegister.this, AccountInfo.class);
      //			LossRegister.this.startActivity(intent);

    }
  }
コード例 #3
0
 @Override
 protected void onListItemClick(ListView l, View v, int position, long id) {
   super.onListItemClick(l, v, position, id);
   Intent intent = new Intent(this, GeatteVotingActivity.class);
   intent.putExtra(Config.GEATTE_ID_PARAM, Long.toString(id));
   startActivityForResult(intent, ACTIVITY_VOTE);
 }
コード例 #4
0
 @Override
 protected void onListItemClick(ListView l, View v, int position, long id) {
   // TODO Auto-generated method stub
   super.onListItemClick(l, v, position, id);
   Log.e("SELECTED CANDIDATE", can_names[position]);
   sendCandidateInfo(can_names[position], can_id[position]);
 }
コード例 #5
0
  @Override
  // ListView内のボタンのイベント処理
  protected void onListItemClick(ListView lv, View v, int pos, long id) {
    super.onListItemClick(lv, v, pos, id);
    CustomData item = (CustomData) lv.getItemAtPosition(pos);

    // いいねボタンが押された場合
    if (id == 0) {
      // user_idとcomment_idを取得してAPIを叩く
      iineTask = new IineTask(this, item);
      iineTask.execute();

      try {
        Thread.sleep(1000);
      } catch (InterruptedException e) {
        e.printStackTrace();
      }

      task = new ListTask(lv, this);
      task.execute();

      // コメント欄ボタンが押された場合
    } else if (id == 1) {
      ImageCache.clearCache();
      Intent intent = new Intent(ImageTwActivity.this, CommentActivity.class);
      intent.putExtra("commentId", item.getCommentId());
      intent.putExtra("comment", item.getTitleName());
      startActivity(intent);
    }
  }
コード例 #6
0
 @Override
 protected void onListItemClick(ListView l, View v, int position, long id) {
   super.onListItemClick(l, v, position, id);
   final Intent intent = new Intent(this, ConvSetEditActivity.class);
   intent.putExtra("cs", this.setsArray[position]);
   this.startActivity(intent);
 }
コード例 #7
0
  @Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);

    mPositions.put(mDirectory.getAbsolutePath(), getListView().getFirstVisiblePosition());

    if (position < (mParent == null ? 0 : 1)) {
      mDirectory = mParent;
      mHandler.post(mUpdateFiles);
      return;
    }

    position -= (mParent == null ? 0 : 1);

    if (position < mDirs.length) {
      mDirectory = mDirs[position];
      mHandler.post(mUpdateFiles);
      return;
    }

    position -= mDirs.length;

    Uri uri = Uri.parse(mFiles[position].getAbsolutePath());
    Intent intent = new Intent(this, MuPDFActivity.class);
    intent.setAction(Intent.ACTION_VIEW);
    intent.setData(uri);
    startActivity(intent);
  }
コード例 #8
0
 protected void onListItemClick(ListView l, View v, int position, long id) {
   super.onListItemClick(l, v, position, id);
   Intent intent;
   switch (position) {
     case 0:
       intent = new Intent(this, FlashLightActivity.class);
       startActivity(intent);
       break;
     case 1: // AboutActivity - About Me
       intent = new Intent(this, AboutActivity.class);
       startActivity(intent);
       break;
     case 2: // Creating a Toast within the case
       Context context = getApplicationContext();
       CharSequence text = "Hello toast!";
       int duration = Toast.LENGTH_LONG;
       Toast toast = Toast.makeText(context, text, duration);
       toast.show();
       // Shorter Version of Toast
       // Toast.makeText(MainActivity.this, "This is my toast", Toast.LENGTH_LONG).show();
       break;
     case 3: // CountActivity
       intent = new Intent(this, CountActivity.class);
       startActivity(intent);
       break;
     case 4: // GraphicsActivity
       intent = new Intent(this, GraphicsActivity.class);
       startActivity(intent);
       break;
     default:
       break;
   }
 }
コード例 #9
0
  @Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);

    String itemStr = ((FileListAdapter.ViewHolder) v.getTag()).filename.getText().toString();
    final File file = new File(mCurrentDir, itemStr);

    if (file.isDirectory()) {
      // Open the file folder
      mCurrentDir = new File(mCurrentDir.getPath() + "/" + itemStr);
      updateListView();
      getListView().setSelection(0);
    } else {
      // SPRD: if sd card and internal storage is not avalible,show toast
      if (!Environment.getExternalStoragePathState().equals(Environment.MEDIA_MOUNTED)
          && !Environment.getInternalStoragePathState().equals(Environment.MEDIA_MOUNTED)) {
        Toast.makeText(getApplicationContext(), R.string.stroage_not_mounted, Toast.LENGTH_LONG)
            .show();
      } else {
        Intent intent = new Intent();
        intent.putExtra("path", file.getAbsolutePath());
        intent.putExtra("name", file.getName());
        setResult(RESULT_OK, intent);
      }
      finish();
    }
  }
コード例 #10
0
  @Override
  protected void onListItemClick(ListView l, View v, int position, long id) {

    super.onListItemClick(l, v, position, id);
    try {

      Intent i = new Intent(this, Messaging.class);
      JSONObject friend = friendAdapter.getItem(position);
      i.putExtra("friendObject", friend.toString());
      startActivity(i);

      Log.e("Friend Id", " " + friend.getString("id"));
      Log.e("Friend Display Name", " " + friend.getString("displayname"));
      Log.e("Friend Email", " " + friend.getString("email"));
      Log.e("Friend Status", " " + friend.getString("status"));
      Log.e("Friend Lattitude", " " + friend.getString("lattitude"));
      Log.e("Friend Longitude", " " + friend.getString("longitude"));
      Log.e("Friend Image", " " + friend.getString("imgstr"));

    } catch (JSONException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    /*Intent i = new Intent(this, Messaging.class);
    FriendInfo friend = friendAdapter.getItem(position);
    i.putExtra(FriendInfo.USERNAME, friend.userName);
    i.putExtra(FriendInfo.PORT, friend.port);
    i.putExtra(FriendInfo.IP, friend.ip);
    startActivity(i);*/
  }
コード例 #11
0
ファイル: SubExercise.java プロジェクト: rmchaara/Workinator
  @Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);
    String selection = l.getItemAtPosition(position).toString();

    selection = selection.replaceAll(" ", "_");

    dialog = new Dialog(SubExercise.this);
    dialog.setContentView(R.layout.instructions);
    dialog.setTitle("Exercise Instructions");
    dialog.setCancelable(true);

    Button close = (Button) dialog.findViewById(R.id.btnInstrCancel);
    TextView instr = (TextView) dialog.findViewById(R.id.lblReturnInstr);

    close.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            dialog.dismiss();
          }
        });

    int res_id = getResources().getIdentifier(selection, "string", this.getPackageName());
    if (res_id != 0) {
      String instructions = getResources().getString(res_id);
      instr.setText(instructions);
    } else {
      instr.setText("Instructions Coming Soon!");
    }
    dialog.show();
  }
コード例 #12
0
 @Override
 protected void onListItemClick(ListView l, View v, int position, long id) {
   super.onListItemClick(l, v, position, id);
   Intent i = new Intent(this, NoteView.class);
   i.putExtra(NotesDbAdapter.KEY_ROWID, id); // el problema parece estar aki
   startActivity(i);
 }
コード例 #13
0
ファイル: AirNotes.java プロジェクト: FusionJT/AirNotes
 @Override
 protected void onListItemClick(ListView l, View v, int position, long id) {
   super.onListItemClick(l, v, position, id);
   Intent i = new Intent(this, AirNoteEdit.class);
   i.putExtra(AirNotesDbAdapter.KEY_ROWID, id);
   startActivityForResult(i, ACTIVITY_EDIT);
 } // onListItemClick
コード例 #14
0
  @Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);

    Cursor note = extObjDB.fetchNote(id);
    startManagingCursor(note);
    ObjSource s;
    int resource_id = note.getInt(note.getColumnIndexOrThrow(ExternObjDB.KEY_RESRC_ID));
    if (resource_id == -1) {
      // obj from sdcard
      String path = note.getString(note.getColumnIndexOrThrow(ExternObjDB.KEY_PATH));
      s = new ObjFromSDcard(path);
    } else {
      // obj from resource
      s = new ObjFromResource(resource_id);
    }
    s.Title = note.getString(note.getColumnIndexOrThrow(ExternObjDB.KEY_TITLE));
    s.Info = note.getString(note.getColumnIndexOrThrow(ExternObjDB.KEY_INFO));
    s.ID = note.getInt(note.getColumnIndexOrThrow(ExternObjDB.KEY_ROWID));
    Bundle bundle = new Bundle();

    bundle.putSerializable(ObjSource.TITLE, s);

    Intent mIntent = new Intent();
    mIntent.putExtras(bundle);
    setResult(RESULT_OK, mIntent);
    finish();
  }
コード例 #15
0
ファイル: OutlineActivity.java プロジェクト: beck0505/android
 @Override
 protected void onListItemClick(ListView l, View v, int position, long id) {
   super.onListItemClick(l, v, position, id);
   OutlineActivityData.get().position = getListView().getFirstVisiblePosition();
   setResult(mItems[position].page);
   finish();
 }
コード例 #16
0
  @Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
    if (isNetworkAvailable() == false) noInternetAccess();

    super.onListItemClick(l, v, position, id);
    ParseObject message = mMessages.get(position);
    String post = message.getString(ParseConstants.KEY_POST);
    String sendername = message.getString(ParseConstants.KEY_SENDER_NAME);

    final Dialog dialog = new Dialog(RumourActivity.this, R.style.Theme_Dialog);
    dialog.setContentView(R.layout.rumour_custom_alert);

    final TextView userInput3 = (TextView) dialog.findViewById(R.id.rumour_custom_et);
    final TextView sender = (TextView) dialog.findViewById(R.id.sender_custom_et);
    final Button ok = (Button) dialog.findViewById(R.id.btn_ok);

    sender.setText(sendername);
    userInput3.setText(post);
    dialog.show();
    ok.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            dialog.dismiss();
          }
        });
  }
コード例 #17
0
  @Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
    // TODO Auto-generated method stub
    super.onListItemClick(l, v, position, id);

    new AlertDialog.Builder(this)
        .setTitle("Hello")
        .setMessage("from " + getListView().getItemAtPosition(position))
        .setPositiveButton(
            "OK",
            new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialog, int which) {}
            })
        .show();

    Toast.makeText(
            ListViewActivity.this,
            "ListView: "
                + l.toString()
                + "\n"
                + "View: "
                + v.toString()
                + "\n"
                + "position: "
                + String.valueOf(position)
                + "\n"
                + "id: "
                + String.valueOf(id),
            Toast.LENGTH_LONG)
        .show();
  }
コード例 #18
0
  @Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
    if (getListAdapter() == mHistoryAdapter) {
      String selection = ((TextView) v.findViewById(android.R.id.text1)).getText().toString();
      mSearchText.setText(selection);
      mSearchText.setSelection(selection.length());
      mSearchText.requestFocus();
    } else if (getListAdapter() == mResultAdapter) {
      // add search text to the database (history)
      MediaDatabase db = MediaDatabase.getInstance(this);
      db.addSearchhistoryItem(mSearchText.getText().toString());

      // open media in the player
      Media item = (Media) getListAdapter().getItem(position - 1);
      if (item.getType() == Media.TYPE_VIDEO) {
        VideoPlayerActivity.start(this, item.getLocation());
      } else {
        ArrayList<String> arr = new ArrayList<String>();
        for (int i = 0; i < getListAdapter().getCount(); i++) {
          Media audioItem = (Media) getListAdapter().getItem(i);
          if (audioItem.getType() == Media.TYPE_AUDIO) arr.add(audioItem.getLocation());
        }
        AudioServiceController.getInstance().load(arr, arr.indexOf(item.getLocation()));
        AudioPlayerActivity.start(this);
      }
      super.onListItemClick(l, v, position, id);
    }
  };
コード例 #19
0
 /** Toggles the task status */
 @Override
 protected void onListItemClick(ListView l, View v, int position, long id) {
   super.onListItemClick(l, v, position, id);
   taskAdapter.toggleTaskStatusAtPosition(position);
   LocalTask t = taskAdapter.getItem(position);
   taskApp.saveTask(t);
 }
コード例 #20
0
 @Override
 protected void onListItemClick(ListView l, View v, int position, long id) {
   super.onListItemClick(l, v, position, id);
   switch (position) {
     case 0:
       Intent intent = ChartFactory.getLineChartIntent(this, getDemoDataset(), getDemoRenderer());
       startActivity(intent);
       break;
     case 1:
       intent = ChartFactory.getScatterChartIntent(this, getDemoDataset(), getDemoRenderer());
       startActivity(intent);
       break;
     case 2:
       intent =
           ChartFactory.getTimeChartIntent(this, getDateDemoDataset(), getDemoRenderer(), null);
       startActivity(intent);
       break;
     case 3:
       XYMultipleSeriesRenderer renderer = getBarDemoRenderer();
       setChartSettings(renderer);
       intent = ChartFactory.getBarChartIntent(this, getBarDemoDataset(), renderer, Type.DEFAULT);
       startActivity(intent);
       break;
   }
 }
コード例 #21
0
 // リスト項目を選択したときに呼ばれる
 protected void onListItemClick(ListView l, View v, int position, long id) {
   TextView t = (TextView) v;
   super.onListItemClick(l, v, position, id);
   Log.i(
       "ListViewSampleSample",
       t.getText().toString() + position); // リスト項目の内容と先頭から何番目であるかを示したpositionをログに表示する
 }
コード例 #22
0
  @Override
  protected void onListItemClick(ListView l, View v, final int position, long id) {
    super.onListItemClick(l, v, position, id);

    if (getListView().isItemChecked(position)) {
      // add friend
      mFriendsRelation.add(mUsers.get(position));

    } else {
      // remove friend
      mFriendsRelation.remove(mUsers.get(position));
    }

    mCurrentUser.saveInBackground(
        new SaveCallback() {
          @Override
          public void done(ParseException e) {
            if (e != null) {
              // failed

              Log.e(TAG, e.getMessage());
            }
          }
        });
  }
コード例 #23
0
 @Override
 protected void onListItemClick(ListView l, View v, int position, long id) {
   super.onListItemClick(l, v, position, id);
   Sample sample = (Sample) getListAdapter().getItem(position);
   Intent intent = new Intent(this, sample.activityClass);
   startActivity(intent);
 }
コード例 #24
0
ファイル: SelectFriends.java プロジェクト: piusvelte/sonet
 @Override
 protected void onListItemClick(ListView list, final View view, int position, final long id) {
   super.onListItemClick(list, view, position, id);
   // add to/remove from return list, update check mark
   if (mFriends.size() > position) {
     HashMap<String, String> friend = mFriends.get(position);
     String esid = friend.get(Entity.ESID);
     boolean checked = false;
     if (mSelectedFriends.contains(esid)) {
       mSelectedFriends.remove(esid);
     } else {
       mSelectedFriends.add(esid);
       checked = true;
     }
     ((CheckBox) ((RelativeLayout) view).getChildAt(0)).setChecked(checked);
     String[] friends = new String[mSelectedFriends.size()];
     for (int i = 0, l = friends.length; i < l; i++) {
       friends[i] = mSelectedFriends.get(i);
     }
     Intent i = new Intent();
     i.putExtra(Accounts.SID, mAccountId);
     i.putExtra(Stags, friends);
     setResult(RESULT_OK, i);
   }
 }
コード例 #25
0
ファイル: MessageList.java プロジェクト: anwell/HLN
 @Override
 protected void onListItemClick(ListView l, View v, int position, long id) {
   super.onListItemClick(l, v, position, id);
   Intent viewMessage =
       new Intent(
           Intent.ACTION_VIEW, Uri.parse(messages.get(position).getLink().toExternalForm()));
   this.startActivity(viewMessage);
 }
コード例 #26
0
ファイル: MiamMiam.java プロジェクト: tlam/MiamMiam
 protected void onListItemClick(ListView l, View v, int position, long id) {
   super.onListItemClick(l, v, position, id);
   TextView category = (TextView) v.findViewById(R.id.category_name);
   Intent i = new Intent(this, FoodItem.class);
   i.putExtra(FoodItem.CATEGORY, category.getText());
   i.putExtra(FoodItem.CATEGORY_ID, id);
   startActivityForResult(i, 1);
 }
コード例 #27
0
  /*
   * show news
   */
  @Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);

    Intent intent = new Intent(getApplicationContext(), NewsActivity.class);
    intent.putExtra("ID", headlines.get(position).id);
    startActivity(intent);
  }
コード例 #28
0
 @Override
 protected void onListItemClick(ListView l, View v, int position, long id) {
   super.onListItemClick(l, v, position, id);
   // Pega o carro naquela posição
   Carro c = (Carro) this.getListAdapter().getItem(position);
   // Exibe um alerta
   Toast.makeText(this, "Você selecionou o Carro: " + c.getNome(), Toast.LENGTH_SHORT).show();
 }
コード例 #29
0
 @Override
 protected void onListItemClick(ListView l, View v, int position, long id) {
   super.onListItemClick(l, v, position, id);
   Intent i = new Intent(this, NoteEdit.class);
   AppNote note = listAdapter.getItem((int) id);
   i.putExtra(AppNote._ID, note.getId());
   startActivityForResult(i, EDITOR_ACTIVITY);
 }
コード例 #30
0
ファイル: FoodoList.java プロジェクト: oripuma/foodo
  @Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);

    Intent i = new Intent(this, FoodoDetails.class);
    i.putExtra(RestaurantDbAdapter.KEY_ROWID, id);
    startActivityForResult(i, DETAILS_VIEW);
  }