How to open image in full screen by clicking on listview in android tutorial app -
the following got till now. bug whenever click on listitem
following error occurs
unfortunately app has stopped working
listviewadapter.class
public class listviewadapter extends baseadapter { protected static long[] itemvie; // declare variables context context; layoutinflater inflater; arraylist<hashmap<string, string>> data; imageloader imageloader; hashmap<string, string> resulta = new hashmap<string, string>(); public listviewadapter(context context, arraylist<hashmap<string, string>> arraylist) { this.context = context; data = arraylist; imageloader = new imageloader(context); } @override public int getcount() { return data.size(); } @override public object getitem(int position) { return null; } @override public long getitemid(int position) { return 0; } @suppresslint("viewholder") public view getview(final int position, view convertview, viewgroup parent) { // declare variables textview albname; imageview portimages; inflater = (layoutinflater) context .getsystemservice(context.layout_inflater_service); view itemvie = inflater.inflate(r.layout.list_item, parent, false); // position resulta = data.get(position); // locate textviews in listview_item.xml albname = (textview) itemvie.findviewbyid(r.id.name); portimages = (imageview) itemvie.findviewbyid(r.id.portimg); albname.settext(resulta.get(portfolio.tag_title)); imageloader.displayimage(resulta.get(portfolio.tag_image), portimages); // capture listview item click itemvie.setonclicklistener(new onclicklistener() { @override public void onclick(view arg0) { resulta = data.get(position); intent intent = new intent(context, fullscreenimage.class); intent.putextra("albname", resulta.get(portfolio.tag_title)); intent.putextra("portimages",resulta.get(portfolio.tag_image)); context.startactivity(intent); } }); return itemvie; } }
fullscreenimage.class
package com.example.truzzapp; public class fullscreenimage extends activity implements onitemselectedlistener { imageview image; textview txt; string port_name; string port_image; progressdialog pdialog; imageloader imageloader = new imageloader(this); protected void oncreate(bundle savedinstancestate) { setcontentview(r.layout.fullimage); intent = getintent(); port_name = i.getstringextra("albname");
port_image = i.getstringextra("portimages");
txt = (textview) findviewbyid(r.id.portheading); image = (imageview) findviewbyid(r.id.portfullimage); txt.settext(port_name); imageloader.displayimage(port_image, image); } @override public void onitemselected(adapterview<?> arg0, view arg1, int arg2, long arg3) { // todo auto-generated method stub } @override public void onnothingselected(adapterview<?> arg0) { // todo auto-generated method stub } }
logcat error
12-02 13:42:45.725: e/androidruntime(1129): fatal exception: main 12-02 13:42:45.725: e/androidruntime(1129): android.app.supernotcalledexception: activity {com.example.truzzapp/com.example.truzzapp.fullscreenimage} did not call through super.oncreate() 12-02 13:42:45.725: e/androidruntime(1129): @ android.app.activitythread.performlaunchactivity(activitythread.java:2025) 12-02 13:42:45.725: e/androidruntime(1129): @ android.app.activitythread.handlelaunchactivity(activitythread.java:2084) 12-02 13:42:45.725: e/androidruntime(1129): @ android.app.activitythread.access$600(activitythread.java:130) 12-02 13:42:45.725: e/androidruntime(1129): @ android.app.activitythread$h.handlemessage(activitythread.java:1195) 12-02 13:42:45.725: e/androidruntime(1129): @ android.os.handler.dispatchmessage(handler.java:99) 12-02 13:42:45.725: e/androidruntime(1129): @ android.os.looper.loop(looper.java:137) 12-02 13:42:45.725: e/androidruntime(1129): @ android.app.activitythread.main(activitythread.java:4745) 12-02 13:42:45.725: e/androidruntime(1129): @ java.lang.reflect.method.invokenative(native method) 12-02 13:42:45.725: e/androidruntime(1129): @ java.lang.reflect.method.invoke(method.java:511) 12-02 13:42:45.725: e/androidruntime(1129): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:786) 12-02 13:42:45.725: e/androidruntime(1129): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:553) 12-02 13:42:45.725: e/androidruntime(1129): @ dalvik.system.nativestart.main(native method)
pay attention logcat
: did not call through super.oncreate()
you forgot call super.oncreate(savedinstancestate);
before setcontentview
Comments
Post a Comment