我有两个GridView
<GridView
android:id="@+id/gridView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="2dp"
android:background="#59A9D2" >
</GridView>
<GridView
android:id="@+id/gridViewMain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/gridView"
android:background="#1E98D5" >
</GridView>
</RelativeLayout>
第一个网格视图包含25个imageView元素。
第二个网格视图包含5个图像(这5个图像来自第一个网格视图图像的25个图像)
用户只能点击第一个网格视图的图像。用户需要在第一个网格视图中找到第二个网格视图图像。
当用户成功进行正确点击时。我希望该图像在第二个网格中变成“右绿色勾选”图像如何在第一个网格视图中执行此onitemclicklistener。
mGridView.setOnItemClickListener(new OnItemClickListener(){
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// TODO Auto-generated method stub
// ToastMessage(position);
if ((mRandomIDList.toArray()[position] == mSolutionList
.toArray()[tempposition])) {
Score = Score + (TimeLeft * (tempposition + 1));
mScoreTextView.setText("Score: " + Score);
//mGridViewMain.getAdapter().getView(tempposition, checkImageView, null);
//mGridViewMain.notifyAll();
if(mMediaPlayer2.isPlaying()){
mMediaPlayer2.stop();
}
mMediaPlayer2.start();
tempposition++;
//Marking the try one image in solution grid view
if (tempposition == 5) {
mCountDownTimer.cancel();
Intent successIntent = new Intent(mContext,
SuccesActivity.class);
successIntent.putExtra("last-score", Score);
successIntent.putExtra("Game Level", PLAY_LEVEL);
startActivity(successIntent);
mMediaPlayer.stop();
mMediaPlayer.reset();
mMediaPlayer.release();
finish();
}
} else {
mCountDownTimer.cancel();
GameOver(mContext, Score);
mMediaPlayer.stop();
mMediaPlayer.reset();
mMediaPlayer.release();
finish();
}