CustomGridActivity.java
Dosyayı İndir
package com.godoro.androidcustoms;
import android.app.*;
import android.os.*;
import android.view.*;
import android.widget.*;
import java.util.*;
public class CustomGridActivity extends Activity {
private List<CustomGridEntity> entityList;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_custom_grid);
GridView gridView=(GridView) findViewById(R.id.gridView);
selectEntityList();
CustomGridAdapter gridAdapter=new CustomGridAdapter(this,entityList);
gridView.setAdapter(gridAdapter);
gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
CustomGridEntity entity=entityList.get(position);
String message="Seçilen varlık: "+entity.getEntityId()+" "+entity.getEntityTitle();
Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show();
}
});
}
private void selectEntityList(){
String folder="http://www.godoro.com/subjects/";
entityList=new ArrayList<CustomGridEntity>();
entityList.add(new CustomGridEntity(501,"Java",folder+"Java.jpg"));
entityList.add(new CustomGridEntity(501,"Kurumsal Java ",folder+"JavaEE.jpg"));
entityList.add(new CustomGridEntity(502,"Android",folder+"Android.jpg"));
entityList.add(new CustomGridEntity(503,"C/C++",folder+"C_CPlusPlus.jpg"));
entityList.add(new CustomGridEntity(504,"C# ASP .NET",folder+"CSharp.jpg"));
entityList.add(new CustomGridEntity(505,"PHP",folder+"PHP.jpg"));
entityList.add(new CustomGridEntity(506,"HTML",folder+"HTML.jpg"));
entityList.add(new CustomGridEntity(507,"SQL",folder+"SQL.jpg"));
}
}
Dosyayı İndir