Closed Sorush-moradisani closed 9 years ago
@Sorush-moradisani Caused by: java.lang.ClassCastException: com.example.samanefarhangi.pulllib.PullToZoomScrollViewEx cannot be cast to com.example.samanefarhangi.pulllib.PullToZoomScrollView
PullToZoomScrollView scrollView = (PullToZoomScrollView) findViewById(R.id.scroll_view); --> change to PullToZoomScrollViewEx scrollView = (PullToZoomScrollViewEx) findViewById(R.id.scroll_view); and try it.
@Sorush-moradisani I update this code,you update and try it.
I changed it but it gives another error! Here is it: it doesn't resolve setHeaderContainer and setContentContainerView!
Problem solved! I don't need setHeaderContainer and setContentContainerView!
private void loadViewForCode() {
PullToZoomScrollViewEx scrollView = (PullToZoomScrollViewEx) findViewById(R.id.scroll_view);
View headView = LayoutInflater.from(this).inflate(R.layout.profile_head_view, null, false);
TextView title = (TextView) findViewById(R.id.tv_title);
title.setText(feed.getTitle());
TextView author = (TextView) findViewById(R.id.tv_author);
author.setText(feed.getAuthor());
TextView date = (TextView) findViewById(R.id.tv_date);
date.setText(feed.getDate());
View zoomView = LayoutInflater.from(this).inflate(R.layout.profile_zoom_view, null, false);
ImageView contentImage = (ImageView) findViewById(R.id.iv_zoom);
try {
new ImageDownloaderTask(contentImage).execute(feed.getAttachmentUrl());
}catch (Exception e){
e.printStackTrace();
}
View contentView = LayoutInflater.from(this).inflate(R.layout.profile_content_view, null, false);
TextView htmlTextView = (TextView) findViewById(R.id.tv_content);
htmlTextView.setText(Html.fromHtml(feed.getContent(), null, null));
//scrollView.setHeaderContainer(headView);
scrollView.setZoomView(zoomView);
//scrollView.setContentContainerView(contentView);
}
@Sorush-moradisani you can try this
private void loadViewForCode() {
PullToZoomScrollViewEx scrollView = (PullToZoomScrollViewEx) findViewById(R.id.scroll_view);
View headView = LayoutInflater.from(this).inflate(R.layout.profile_head_view, null, false);
View zoomView = LayoutInflater.from(this).inflate(R.layout.profile_zoom_view, null, false);
View contentView = LayoutInflater.from(this).inflate(R.layout.profile_content_view, null, false);
scrollView.setHeaderView(headView);
scrollView.setZoomView(zoomView);
scrollView.setScrollContentView(contentView);
}
Tnx! It works pretty fine!
Hi. I'm trying to set my contents from java class but it gives me the following error: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.samanefarhangi/com.example.samanefarhangi.PullToZoomScrollActivity}: java.lang.ClassCastException: com.example.samanefarhangi.pulllib.PullToZoomScrollViewEx cannot be cast to com.example.samanefarhangi.pulllib.PullToZoomScrollView at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2439) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2495) at android.app.ActivityThread.access$800(ActivityThread.java:153) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1349) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:157) at android.app.ActivityThread.main(ActivityThread.java:5633) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:896) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:712) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.ClassCastException: com.example.samanefarhangi.pulllib.PullToZoomScrollViewEx cannot be cast to com.example.samanefarhangi.pulllib.PullToZoomScrollView
here is the code: private void loadViewForCode() {
I think it's a library problem!