Envoyé par
Hephaistos007
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
public class SwipeDetector implements OnGestureListener {
private final MixDetail myActivity;
public SwipeDetector(MixDetail a) {
this.myActivity = a;
}
@Override
public boolean onFling(...) {
...
this.myActivity.next();
...
}
} |
ok je commence à comprendre la manip
en revanche dans mon activité principale
j'ai cette erreur
1 2 3 4
| Multiple markers at this line
- The constructor SwipeDetector() is undefined
- The constructor GestureDetector(GestureDetector.OnGestureListener) is
deprecated |
du coup j'ai modif par :
gestureDetector = new GestureDetector( new SwipeDetector(null) );
mais j'ai cette erreur
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| 11-08 14:13:19.671: E/AndroidRuntime(11327): FATAL EXCEPTION: main
11-08 14:13:19.671: E/AndroidRuntime(11327): java.lang.NullPointerException
11-08 14:13:19.671: E/AndroidRuntime(11327): at com.xxxx.mix.SwipeDetector.onFling(SwipeDetector.java:34)
11-08 14:13:19.671: E/AndroidRuntime(11327): at android.view.GestureDetector.onTouchEvent(GestureDetector.java:568)
11-08 14:13:19.671: E/AndroidRuntime(11327): at com.xxxx.mix.MixDetail.dispatchTouchEvent(MixDetail.java:121)
11-08 14:13:19.671: E/AndroidRuntime(11327): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1791)
11-08 14:13:19.671: E/AndroidRuntime(11327): at android.view.ViewRoot.handleMessage(ViewRoot.java:1794)
11-08 14:13:19.671: E/AndroidRuntime(11327): at android.os.Handler.dispatchMessage(Handler.java:99)
11-08 14:13:19.671: E/AndroidRuntime(11327): at android.os.Looper.loop(Looper.java:143)
11-08 14:13:19.671: E/AndroidRuntime(11327): at android.app.ActivityThread.main(ActivityThread.java:4717)
11-08 14:13:19.671: E/AndroidRuntime(11327): at java.lang.reflect.Method.invokeNative(Native Method)
11-08 14:13:19.671: E/AndroidRuntime(11327): at java.lang.reflect.Method.invoke(Method.java:521)
11-08 14:13:19.671: E/AndroidRuntime(11327): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-08 14:13:19.671: E/AndroidRuntime(11327): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-08 14:13:19.671: E/AndroidRuntime(11327): at dalvik.system.NativeStart.main(Native Method) |
avant l'appel de cette fonction
1 2 3 4 5 6 7 8 9 10 11 12
| public void next(){
MainApp.log("next");
try {
Intent intent = new Intent(MixDetail.this, HomeActivity.class );
startActivity(intent);
} catch (Exception e) {
MainApp.log("next error => "+e);
}
} |
Partager