feraco
Aspiring developer
Profile
Posts: 705
Reg: Jan 23, 2012
nyc
15,050
02/08/15 01:17 PM (9 years ago)

NAD Quiz android error

Ok i created an apk with no problem for a debug but when i try to create apk for release i get this error this fragment inner class should be static Its Happening in the java file- Show alert dialog is red- Can you help me? right here public class showAlertDialog extends DialogFragment { @Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage(explanationText).setPositiveButton("Continue", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // perform action here BT_debugger.showIt("running showNextQuestion inside alert dialog"); showNextQuestion(); } }); return builder.create(); //return;
 
nadthevlad
Code is Art
Profile
Posts: 1025
Reg: Jun 07, 2012
Denver
21,850
like
02/08/15 06:09 PM (9 years ago)
I have a fix for that. Will post later tonight.
 
feraco
Aspiring developer
Profile
Posts: 705
Reg: Jan 23, 2012
nyc
15,050
like
02/08/15 06:45 PM (9 years ago)
Ok for now I selected the suppress option in android studio. Thanks NAD!
 
nadthevlad
Code is Art
Profile
Posts: 1025
Reg: Jun 07, 2012
Denver
21,850
like
02/08/15 09:04 PM (9 years ago)
Try this. public static class showAlertDialog extends DialogFragment { @Override public Dialog onCreateDialog(Bundle savedInstanceState) { String expText = ""; FragmentManager fragmentManager = getFragmentManager(); final Fragment fragment = fragmentManager.findFragmentById(R.layout.nad_advanced_quiz); if(fragment != null ){ expText = ((NAD_advanced_quiz)fragment).explanationText; }else{ BT_debugger.showIt("Problem Referencing fragment"); } AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage(expText).setPositiveButton("Continue", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // perform action here BT_debugger.showIt("running showNextQuestion inside alert dialog"); if(fragment != null) { ((NAD_advanced_quiz)fragment).showNextQuestion(); } } }); return builder.create(); //return; } }
 
aussiedra
Code is Art
Profile
Posts: 431
Reg: Dec 25, 2010
Brisbane, Austr...
8,260
like
03/18/15 02:44 AM (9 years ago)
seeing this error :-(
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.