I am using this code for make new listener for every new item
first the xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/list_row_selector"
android:padding="8dp"
android:id="@+id/showonmap"
android:alpha="0.9">
<!-- Thumbnail Image -->
<!-- notofocation Title -->
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15dp"
android:textStyle="bold" />
<!-- -->
<TextView
android:id="@+id/rating"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/title"
android:layout_marginTop="1dip"
android:textSize="@dimen/rating" />
<!-- Genre -->
<TextView
android:id="@+id/genre"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/rating"
android:layout_marginTop="5dp"
android:textColor="@color/genre"
android:textSize="@dimen/genre" />
<!-- date -->
<TextView
android:id="@+id/releaseYear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:textColor="@color/year"
android:textSize="@dimen/year" />
I just parse the JSON array response and make new item depend on array length
after that I add listener to the
.. RelativeLayout with id showonmap
and when click on its it open new activity the code of Onclick
showonmaps.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent intent = new Intent(context, show_notification.class);
intent.putExtra("lat", m.getGenre().get(0));
intent.putExtra("lang", m.getGenre().get(1));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
}
});
here I am using
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
and when use
Intent intent = new Intent(context,
show_notification.class);
context.startActivity(intent);
the application stopped so i must back and use
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
but when I use it and open new activity and press back button its exit from the application any idea or solution ?