2016-07-12 12 views
1

に応答していない - >アクティビティBに
私は戻って活動A(戻るボタンを押すことによって)
アクティビティBに行きます - >アクティビティA
アクティビティB
アクティビティB
アプリケーションが応答しません。考えられる理由とその解決策は何か?ここ コードである: -
アクティビティA: -アプリケーションは、私が<br> 活動A活動を通じて活動Bに移動するスライドトランジションを適用による移行

package com.tester; 

import android.annotation.SuppressLint; 
import android.app.ActivityOptions; 
import android.content.Intent; 
import android.graphics.Typeface; 
import android.os.Bundle; 
import android.support.v7.app.AppCompatActivity; 
import android.transition.Scene; 
import android.transition.Slide; 
import android.transition.TransitionManager; 
import android.view.Gravity; 
import android.view.View; 
import android.view.View.OnClickListener; 
import android.view.ViewGroup; 
import android.widget.ImageView; 
import android.widget.TextView; 

public class Anima extends AppCompatActivity { 
    ViewGroup root_scene; 
    Bundle bundle; 
    @SuppressLint("NewApi") 
    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.anima); 
     root_scene = (ViewGroup) findViewById(R.id.root_scene); 
     ImageView iv = (ImageView) findViewById(R.id.info_image); 
     /*final Slide slide = new Slide(Gravity.TOP); 
     slide.addTarget(R.id.test_image); 
     getWindow().setEnterTransition(slide); 
     */ 
     bundle = ActivityOptions.makeSceneTransitionAnimation(this).toBundle(); 
     TextView tv = (TextView) findViewById(R.id.head); 
     Typeface type = Typeface.createFromAsset(getAssets(), "roboto.ttf"); 
     tv.setTypeface(type); 
     tv.setText("Armed robbers used Pokémon Go to target victims in Missouri"); 
     iv.setOnClickListener(new OnClickListener() { 

      @Override 
      public void onClick(View arg0) { 
       // TODO Auto-generated method stub 
       Intent intent = new Intent(Anima.this,Second.class); 
       startActivity(intent,bundle); 
      } 
     }); 

    } 
} 

アクティビティB: -

import android.annotation.SuppressLint; 
import android.app.ActivityOptions; 
import android.content.Intent; 
import android.graphics.Typeface; 
import android.os.Bundle; 
import android.support.v7.app.AppCompatActivity; 
import android.transition.Slide; 
import android.view.Gravity; 
import android.widget.TextView; 

public class Second extends AppCompatActivity{ 
    Bundle bundle; 
    @SuppressLint("NewApi") 
    @Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.another_scene); 
     bundle = ActivityOptions.makeSceneTransitionAnimation(this).toBundle(); 
    TextView tv2 = (TextView) findViewById(R.id.details); 
    Typeface type = Typeface.createFromAsset(getAssets(), "robot_light.ttf"); 
    tv2.setTypeface(type); 
    tv2.setText("As popular as Pokémon Go has become, that it sends players out into the real world to find Pokémon is creating new, unexpected problems. The O'Fallon, Missouri Police Department reported on Facebook today that armed robbers have used the app to lure victims in and rob them at gunpoint.\nThe police received reports about the robberies and were able to apprehend four suspects in the area. Apparently, the thieves used the app to set up a beacon at a Pokéstop within the game. Using this method, Sergeant Bill Stringer of the OPD told Motherboard that the culprits were able to rob 11 players, all between the ages of 16 and 18, in the St. Louis and St. Charles counties of Missouri."); 
    Slide slide = new Slide(Gravity.BOTTOM); 
    slide.addTarget(tv2); 
    getWindow().setEnterTransition(slide); 
} 

} 
+2

ログを共有してください – sJy

+0

@sJyアプリケーションはクラッシュしません。それはちょうどハングアップします。 – user6556461

+0

@sJy編集内容をご覧ください – user6556461

答えて

1

アクティビティのonClick()メソッド内部アニマであなた初期化を移動します。試してみてください

iv.setOnClickListener(new OnClickListener() { 
    @Override 
    public void onClick(View arg0) { 
     // TODO Auto-generated method stub 
     bundle = ActivityOptions.makeSceneTransitionAnimation(Anima.this).toBundle(); 
     Intent intent = new Intent(Anima.this,Second.class); 
     startActivity(intent,bundle); 
    } 
}); 
+0

ActivityOptions型のメソッドmakeSceneTransitionAnimation(Activity、Pair ...)は引数には適用されません(新しいView.OnClickListener(){}) – user6556461

+0

@ user6556461更新された回答を確認してください – sJy

+0

Thanks dude。魅力のように働いて、間違いを教えてくれる? – user6556461

関連する問題