![]() |
|
Programación y Desarrollo para Android Subforo exclusivo para temas de programación de software para PDAs y desarrollo de aplicaciones, interfaces, etc bajo Android |
«
Tema Anterior
|
Siguiente tema
»
|
Herramientas |
#1
|
||||
|
||||
Problema: thread exiting with uncaught exception
Hola, tengo un problema con nineoldandroids, me da error cuando ejecuto la activity y lo que me dice es esto:
En el log mi app: [PHP]03-24 20:02:10.091: W/dalvikvm(14727): threadid=15: thread exiting with uncaught exception (group=0x40018578) [/PHP] Mi clase java: [PHP]package com.JimSoft.Edu.LearnWithEnuma; import java.util.Timer; import java.util.TimerTask; import android.app.Activity; import android.net.Uri; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.ViewTreeObserver.OnGlobalLayoutListen er; import android.widget.ImageButton; import android.widget.LinearLayout; import com.nineoldandroids.animation.ObjectAnimator; /** * A simple {@link Fragment} subclass. Activities that contain this fragment * must implement the {@link MainMenuFragment.OnFragmentInteractionListener} * interface to handle interaction events. Use the * {@link MainMenuFragment#newInstance} factory method to create an instance of * this fragment. * * public class MainMenuFragment extends Fragment implements OnClickListener,OnFragmentInteractionListener, OnGlobalLayoutListener{ // TODO: Rename parameter arguments, choose names that match // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER private static final String ARG_PARAM1 = "param1"; private static final String ARG_PARAM2 = "param2"; private ObjectAnimator AprendeAlpha1, AprendeAlpha2; // TODO: Rename and change types of parameters private String mParam1; private String mParam2; private ImageButton btnAprende,btnPractica,btnCuentos; private View view; private OnFragmentInteractionListener mListener; private LinearLayout lytBackGroundAprende; private LinearLayout txtAprende; public String VT; public float HT; /** * Use this factory method to create a new instance of this fragment using * the provided parameters. * * @param param1 * Parameter 1. * @param param2 * Parameter 2. * @RETURN A new instance of fragment MainMenuFragment. * // TODO: Rename and change types and number of parameters public static MainMenuFragment newInstance(String param1, String param2) { MainMenuFragment fragment = new MainMenuFragment(); Bundle args = new Bundle(); args.putString(ARG_PARAM1, param1); args.putString(ARG_PARAM2, param2); fragment.setArguments(args); return fragment; } public MainMenuFragment() { // Required empty public constructor } @override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { mParam1 = getArguments().getString(ARG_PARAM1); mParam2 = getArguments().getString(ARG_PARAM2); } } private void onAttach() { } @override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment view=inflater.inflate(R.layout.fragment_main_menu, container, false); lytBackGroundAprende = (LinearLayout)view.findViewById(R.id.LytBackground Aprende); txtAprende = (LinearLayout)view.findViewById(R.id.TituloAprende ); lytBackGroundAprende.getViewTreeObserver().addOnGl obalLayoutListener(this); txtAprende.getViewTreeObserver().addOnGlobalLayout Listener(this); return view; } private void AnimacionMaterial1() { TimerTask Anima1 =new TimerTask() { @override public void run() { AprendeAlpha2 = new ObjectAnimator(); ObjectAnimator.ofFloat(txtAprende, "alpha", 1,0).setDuration(999).start(); AnimacionMaterial2(); } }; Timer Tim = new Timer(); Tim.schedule(Anima1, 1000); } private void AnimacionMaterial2() { TimerTask Anima2 =new TimerTask() { @override public void run() { AprendeAlpha1 = new ObjectAnimator(); ObjectAnimator.ofFloat(lytBackGroundAprende, "alpha", 0,1).setDuration(999).start(); AnimacionMaterial1(); } }; Timer Tim = new Timer(); Tim.schedule(Anima2, 1000); } // TODO: Rename method, update argument and hook method into UI event public void onButtonPressed(Uri uri) { if (mListener != null) { mListener.onFragmentInteraction(uri); } } @override public void onAttach(Activity activity) { super.onAttach(activity); try { mListener = (OnFragmentInteractionListener) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement OnFragmentInteractionListener"); } } @override public void onDetach() { super.onDetach(); mListener = null; } @override public void onClick(View view) { // TODO Auto-generated method stub // switch (view.getId()) { // case R.id.btnAprende: // FragmentManager fragmentManager = // getFragmentManager(); // Fragment Fragmentos = null; // Fragmentos = new PalleteFragment(); // fragmentManager.beginTransaction().replace(R.id.co ntent_frame, Fragmentos).commit(); // // // Toast.makeText(getActivity(), VT, Toast.LENGTH_SHORT).show(); // //ObjectAnimator.ofFloat(btnAprende, "rotationY", 0,360).setDuration(500).start(); // break; / // default: // break; // } } @override public void onFragmentInteraction(Uri uri) { // TODO Auto-generated method stub } @override public void onGlobalLayout() { AnimacionMaterial1(); } } [/PHP] Es estas lineas las que causan el error pero no se por que si tienia otra app en las que funcionaban a las mil maravillas por que las coloco como comentario y la app funciona de forma correcta pero no se anima. [PHP]AprendeAlpha1 = new ObjectAnimator(); ObjectAnimator.ofFloat(lytBackGroundAprende, "alpha", 0,1).setDuration(999).start();[/PHP] Espero que alguien pueda ayudarme, agradecimientos de antemano y gracias por leer. |
|
Respuesta |
![]() |
||||||
|
«
Tema Anterior
|
Siguiente tema
»
|
|
Hora actual: 16:42:40 (GMT +2)
HTCMania: líderes desde el 2007