I always get an Error in my Android Project.
java.lang.NullPointerException: Attempt to invoke virtual method \'android.view.View android.app.Activi
Use the following code:
listView1.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView> parent, View view, int position, long id) {
// selectedPosition = position;
View newTypeView=listView1.getChildAt(position-listView1.getFirstVisiblePosition()).findViewById(R.id.RelativeLayout);
if (newTypeView.getClass().getName().toString().contains("RelativeLayout")) {
if (lastTouchedVw != null)
lastTouchedVw.setBackgroundColor(Color.parseColor("#ffffff"));
// mainImageView.setImageURI(Uri.parse(al.get(position).toString()));
//bigImageRelativeLayoutVw.setBackgroundColor(Color.parseColor("#ffb000"));
newTypeView.setBackgroundResource(R.drawable.cellbg);
lastTouchedVw = newTypeView;
}