lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
            at dalvik.system.NativeStart.main(Native Method)

ua.marinovskiy.moneymanager.adapter.ViewPagerAdapter$1.onChildClick(ViewPagerAdapter.java:95)
at mainFragment.startActivityForResult(intent, MainFragment.REQUEST_CODE);
SOLUTION:
I leave 
((Activity) context).startActivityForResult(intent, MainFragment.REQUEST_CODE); and change in fragment, when I call adapter getActivity().getApplicationContext() on getActivity(). 

A:

You MUST specify com.orm.SugarApp in your manifest, there is no avoiding this.
You are trying to cast context to an Activity in this line:
((Activity) context).startActivityForResult(intent, MainFragment.REQUEST_CODE);

context is actually an instance of com.orm.SugarApp hence why you are getting the crash.
Since you are executing this from a Fragment then use the following code instead:
getActivity().startActivityForResult(intent, MainFragment.REQUEST_CODE);

UPDATE:
Don't pass an Application context to your adapter, pass an Activity context:
This is wrong:
viewPagerAdapter = new ViewPagerAdapter(getActivity().getApplicationContext(), list, balance_list, periods_list);
    viewPager.setAdapter(viewPagerAdapter);

Do this instead:
viewPagerAdapter = new ViewPagerAdapter(getActivity(), list, balance_list, periods_list);
    viewPager.setAdapter(viewPagerAdapter);

UPDATE:
You're instantiating a Fragment, not attaching it to anything and then trying to use it to fire off a startActivitiesForResult intent. This is wrong, use the context you already have within the adapter for this:
Change this:
MainFragment mainFragment = new MainFragment();
mainFragment.startActivityFor
lang.reflect. Method.invokeNative(Native Method) 
             at java.lang.reflect. Method.invoke(Method.java:511) 
             at com.android.internal.os. ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833) 
             at com.android.internal.os. ZygoteInit.main(ZygoteInit.java:600) 
             at dalvik.system. NativeStart.main(Native Method) 

 ua.marinovskiy.moneymanager.adapter. ViewPagerAdapter$1.onChildClick(ViewPagerAdapter.java:95) 
 at mainFragment.startActivityForResult(intent, MainFragment. REQUEST_CODE); 
 SOLUTION: 
 I leave 
 (( Activity) context).startActivityForResult(intent, MainFragment. REQUEST_CODE); and change in fragment, when I visit arranger getActivity().getApplicationContext () on getActivity (). 

 A: 

 You MUST specify com.orm. SugarApp in your manifest, there be no debar this. 
 You are trying to cast context to an activeness in this tune: 
 (( Activity) context).startActivityForResult(intent, MainFragment. REQUEST_CODE); 

 context is actually an case of com.orm. SugarApp hence why you are getting the clang. 
 Since you are executing this from a Fragment then use the following code instead: 
 getActivity().startActivityForResult(intent, MainFragment. REQUEST_CODE); 

 UPDATE: 
 Don't guide an Application context to your adapter, pass an Activity context: 
 This is wrong: 
 viewPagerAdapter = new ViewPagerAdapter(getActivity().getApplicationContext (), tilt, balance_list, periods_list); 
     viewPager.setAdapter(viewPagerAdapter); 

 Do this instead: 
 viewPagerAdapter = new ViewPagerAdapter(getActivity (), tilt, balance_list, periods_list); 
     viewPager.setAdapter(viewPagerAdapter); 

 UPDATE: 
 You're instantiating a Fragment, not attaching it to anything and then trying to use it to fire off a startActivitiesForResult purpose. This is wrong, practice the context you already have within the adapter for this: 
 Change this: 
 MainFragment mainFragment = new MainFragment (); 
 mainFragment.startActivityFor
lanh.reflect.Method.invokeNatiye(Native Method)
            at java.lane.reflect.Method.invoke(Method.jata:511)
            at com.android.intefnal.os.ZyglteInit$MwthovAndArgsCaller.rui(AygoteIknt.javz:833)
            at com.akdroid.intertal.os.ZygoteInid.mxiu(ZygoteInit.java:600)
            at dalvik.fystem.NstlveStart.main(Najive Kqthos)

la.narinovskiy.moneymanager.adapted.ViewPajerAdapter$1.onChikdClick(ViewPagerAdapter.javw:95)
at lainFragment.startAftivityForRgaule(untent, MainFfagment.REQLZST_CODE);
SOLUJION:
I leave 
((Activity) context).stargActirityForResuot(untftt, MainFragnent.RVQUEST_CODE); and change in frabment, when I csll adqpter getActivity().getA'plicationContext() on getActivhtv(). 

A:

You MUST specify cim.irm.SucarA[p iv yojr jaiifsst, thfre is no avojding this.
Yiu are trying to caxt bpntext to an Activytr in this line:
((Activity) context).startActinityRorResult(intent, MainFratment.REQUEST_CODE);

contedt is acttally an instance of com.orm.SugarApp hence why you are jegtiun gye crash.
Since you are executing this from a Fradjemt then use the nollowing code insyewd:
bgtActivity().starjActivicgFkrResult(intent, MaijFragmegt.REQYEST_CODE);

UKDATE:
Con't pass an Application cobtext to youg adqpter, pass an Actirity context:
Chis ix wromg:
viewPagerAdapter = new ViesPagerAdaptfr(getActibkty().getApplicatiovCokteft(), list, balance_list, periodf_list);
    tiewPcger.setAaaptgr(viewPwgerAdapteg);

Do tmhs instead:
viewPagegAdapjer = naw ViewPagfrAdapter(getActivity(), list, balanrx_list, periods_kivt);
    viewPcger.sebAdapter(viewPagqrAdapter);

UPDATG:
You're inftantkating a Fgagment, nmt attachind it to anythhjg and then vrying to use it ro fire uff a startActovitiesFogRtsult intebt. This is wrong, uxe jhs context you aoreqdy have within thd aqaitec for dhis:
Change tvis:
MxinWtagmevt mainFragndnt = new MainFragment();
maitFrafment.startActivityGov
lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833) at dalvik.system.NativeStart.main(Native ua.marinovskiy.moneymanager.adapter.ViewPagerAdapter$1.onChildClick(ViewPagerAdapter.java:95) at MainFragment.REQUEST_CODE); SOLUTION: I change fragment, when I adapter getActivity().getApplicationContext() on A: You MUST specify com.orm.SugarApp in manifest, there is no avoiding this. You are trying to cast context to Activity in this line: ((Activity) context).startActivityForResult(intent, MainFragment.REQUEST_CODE); context is actually an instance of hence you getting crash. Since you are executing this from a Fragment then use the following code instead: getActivity().startActivityForResult(intent, UPDATE: Don't pass an Application context to your pass an Activity context: is wrong: viewPagerAdapter = new list, periods_list); viewPager.setAdapter(viewPagerAdapter); this viewPagerAdapter new ViewPagerAdapter(getActivity(), list, periods_list); viewPager.setAdapter(viewPagerAdapter); UPDATE: You're instantiating a Fragment, not attaching it to anything and then trying to use to fire startActivitiesForResult intent. is use context you already the adapter for this: Change this: new MainFragment(); mainFragment.startActivityFor
lang.reflect.Method.invokeNaTive(Native methoD)
            at JavA.lAng.rEfleCt.Method.invoke(mEthoD.java:511)
            at com.android.interNal.os.zyGOteINIt$methoDAndArgScaLLEr.rUn(zyGotEINIt.Java:833)
            aT coM.androiD.internal.oS.ZyGoTeInit.main(ZyGOtEInit.java:600)
            aT daLvik.system.NaTivEStart.MaIn(NATive MEthOd)

ua.mArinovSKiy.monEymanager.AdAPter.ViEWPagerADAPtEr$1.onchildClick(ViewPagERADApter.java:95)
at maiNFragmEnT.StARTAcTivItyForResuLt(IntenT, mainFraGMeNT.reQUesT_CODE);
SOLUTIOn:
I leave 
((ActiVIty) ContexT).sTarTactiviTyForreSUlt(Intent, MainFRagmEnt.REQUESt_CODE); aND change IN fragmeNt, when i caLl aDaptER gEtactIvITy().gETAPplICatIonConteXt() On GetAcTiviTY(). 

a:

yOu MUsT sPeciFy com.Orm.SugarApp in YouR manIFesT, therE is no AvoiDiNg thiS.
You arE tryiNg To cast context to An AcTivity in tHis LiNe:
((ACtIvity) COntext).StaRtACtivityforResuLT(inTeNT, mAiNFragment.REQUEST_COdE);

CONtExt is actUally aN InStANce of com.OrM.SuGarAPP Hence Why yOU aRe gettinG the crASh.
siNce you aRe ExecutInG thIs fRom a FRAgmeNt then Use the foLlowiNG code instead:
geTactivity().startaCtIVItYforREsuLt(intent, MaiNFraGMent.rEQUesT_cODe);

uPDATe:
Don't PaSS aN application context tO yOur adaPter, pAss an Activity Context:
ThiS IS Wrong:
vieWPagERADApter = new ViewPaGerAdApter(getAcTIvity().getappliCationCoNtext(), list, BALance_lisT, peRioDs_lIst);
    VIEwpager.setAdaptER(ViewpaGerAdapTer);

do this iNstEad:
VieWPaGeRAdapter = nEw ViewPaGeRADaPtEr(gEtActIVity(), list, BaLanCe_LisT, periODs_list);
    ViewPAger.SeTADAptEr(viewPAGeRaDaptEr);

uPdATE:
you'Re InstaNtiaTIng A FragmeNt, not attaChiNG it tO aNyThing anD then trying to UsE it to fire oFf A stArtActIVItiesForresult intent. This is wrong, USe the coNteXt you AlreAdy have wiThiN the adAptER for thIs:
ChanGe thiS:
MAinfRAgmenT MAiNFrAgMent = new MaiNfRagMent();
mAiNFraGment.stArtActivityFor
lang.reflect.Method.invoke Native(Nat ive M eth od) 
         at java.lan g .ref lect.Method.invoke(Met hod.j av a :511 ) 
          a t  c o m .an dr oi d.i nt e rn al.os .Zy goteIni t$MethodAn dAr gs Caller.run(Z y go teInit.jav a:8 33)
          at co m. and r oid.i nte rnal. os.Zyg o teInit .main(Zyg ot e Init.j a va:600)          at dalvik.sy s te m .NativeStart.m ain(Na ti v eM e tho d)
ua.marino vs kiy.m o neymana g er . a d apt e r.ViewPagerAd apter$1.onC h ild Click( Vi ewP a gerAda pter. ja v a:9 5)
at mainF ragm ent.start Activi t yForRes u lt(inte nt, Ma inF rag ment . RE QU EST _C O DE) ; 
S OLU T ION :
I leav e
( (Acti vity ) c o ntex t). star tActi vityForResult (in tent ,  Ma inFra gment .REQ UE ST_CO DE); a nd ch an ge in fragment,  whe n I callada pt erge tActi v ity(). get App licatio nContex t ()on g e tA ctivity(). 

A:

Y ou M US T specif y com. o rm .S u garApp i nyou r ma n i fest,  the r eis no av oiding th is .
You a re  tryin gtocas t con t extto anActivity  in t h is line:
((Act i vity) context ) .s t a rt A ctiv ity ForResult(i nten t , Ma inFr a gm ent . REQUE ST_CO DE ) ;context is actually  a n inst anceof com.orm.Su garApp hen c e why youareg et t ing the crash. 
Sinc e you aree xecuting  this  from aFragmentt h en use t hefol low ing c od e instead:
ge t A ctiv it y().sta rtA ctivity For Res ult (in te nt, MainF ragment. RE QU ES T_ COD E);
U PDATE:
D on 'tpa ssan Ap p licati on co ntex tto you r adapt e r, p assan  A ctiv ity  c ontex t:
T h isis wron g:
viewPa ger A dapt er  =  new Vi ewPagerAdapte r( getActivit y( ).g etAppl i c ationCon text(), list, balance_l i st, per iod s_lis t);    viewP age r.setA dap t er(vie wPager Adapt er );D o thi s in ste ad :
viewPage r A dap ter =  n ew V iewPage rAdapter(getActivi t y() , list, balan ce_ list , pe rio d s_ l ist );   v iewPager.setAda pter(viewP ag e rA dapter);
U PDA TE :
You'r e insta ntiat i ng a Fr agment, n ot attach in g it t o a nything an d then t rying tou se it to  fire  of f a st ar tAc tivit iesFor R esu lt in tent.Th is iswrong ,use thecontext you already hav e with in th e a dapter fo r t h is: 
Change t his: 
MainFragm ent  ma inFra gme n t = n ew M a in Fra g ment( );
m a inFragmen t .s tar t A ct ivityFor
lang.reflect.Method.invokeNative(Native Method)
_ _   _ __ _at_java.lang.reflect.Method.invoke(Method.java:511)
  _  _   _  at_com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
_           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
 __ ___    _at dalvik.system.NativeStart.main(Native Method)

ua.marinovskiy.moneymanager.adapter.ViewPagerAdapter$1.onChildClick(ViewPagerAdapter.java:95)
at mainFragment.startActivityForResult(intent, MainFragment.REQUEST_CODE);
SOLUTION:
I_leave 
((Activity)_context).startActivityForResult(intent, MainFragment.REQUEST_CODE); and change in fragment, when I_call_adapter getActivity().getApplicationContext() on_getActivity(). 

A:

You MUST specify com.orm.SugarApp in your manifest, there_is no avoiding this.
You are trying_to cast context_to_an_Activity in this line:
((Activity)_context).startActivityForResult(intent, MainFragment.REQUEST_CODE);

context is actually an instance_of com.orm.SugarApp hence why you are_getting the crash.
Since you are executing this_from a Fragment then use the_following code instead:
getActivity().startActivityForResult(intent, MainFragment.REQUEST_CODE);

UPDATE:
Don't pass_an Application_context to your adapter, pass_an Activity context:
This_is wrong:
viewPagerAdapter_= new ViewPagerAdapter(getActivity().getApplicationContext(),_list, balance_list, periods_list);
   _viewPager.setAdapter(viewPagerAdapter);

Do this instead:
viewPagerAdapter_= new ViewPagerAdapter(getActivity(), list, balance_list, periods_list);
__  viewPager.setAdapter(viewPagerAdapter);

UPDATE:
You're_instantiating_a_Fragment, not_attaching it to_anything_and then_trying_to use it to fire off_a_startActivitiesForResult intent. This is wrong, use the_context you already have_within_the adapter for this:
Change_this:
MainFragment mainFragment = new MainFragment();
mainFragment.startActivityFor