android - Activity closed in middle of work and redirect it to previous activity -
i created app loan survey. in each survey 80 90 questions have been displayed. questions displayed 1 one when press next button. views r created programatically , after submitting each question have removed views , create views.
it works fine, problem is, when in 30 40 th question activity closes , redirect previous activity. not executing onpause method also. dont know problem. there no app crash also. don't no whether caused due memory error or other. please suggest me how solve it.
thanks in advance
here how close reach using combination of answer of rotation of image around itself , this post of moving image in circular path
//i imageview here // method rotate globe private void applyrotation(float start, float end) { //first animation circular path final animation rotation = new myanimation(i, 2000); rotation.setduration(10000); rotation.setrepeatcount(0); //rotation of iamge final animation rotation2 = new rotateanimation(30, 360, i.getwidth()/2, i.getheight()/2); rotation2.setfillafter(true); rotation2.setrepeatcount(0); rotation2.setduration(10000); rotation2.setinterpolator(new linearinterpolator()); //combine in set animationset s = new animationset(false); s.addanimation(rotation); s.addanimation(rotation2); i.startanimation(s); }
myanimation.java
package com.example.tempp; import android.view.view; import android.view.animation.animation; import android.view.animation.transformation; public class myanimation extends animation { private view view; private float cx, cy; // center x,y position of circular path private float prevx, prevy; // previous x,y position of image during animation private float r; // radius of circle /** * @param view - view animated * @param r - radius of circular path */ public myanimation(view view, float r){ this.view = view; this.r = r; } @override public boolean willchangebounds() { return true; } @override public void initialize(int width, int height, int parentwidth, int parentheight) { // calculate position of image center int cximage = width / 2; int cyimage = height / 2; cx = view.getleft() + cximage; cy = view.gettop() + cyimage; // set previous position center prevx = cx; prevy = cy; } @override protected void applytransformation(float interpolatedtime, transformation t) { if(interpolatedtime == 0){ // ran issue interpolated return; } float angledeg = (interpolatedtime * 360f + 90) % 360; float anglerad = (float) math.toradians(angledeg); // r = radius, cx , cy = center point, = angle (radians) float x = (float) (cx + r * math.cos(anglerad)); float y = (float) (cy + r * math.sin(anglerad)); float dx = prevx - x; float dy = prevy - y; prevx = x; prevy = y; t.getmatrix().settranslate(dx, dy); } }
hope helps.
Comments
Post a Comment