IllegalStateException: Can not perform this action after onSaveInstanceState with onActivityResult - java

I am new to Android development. I got an issue. I tried the last couple of hour but I can't figure out this. if so I got a popular question. IllegalStateException: Can not perform this action after onSaveInstanceState with ViewPager but failed because of the lack of Android development experience.
Here is code:
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == 1) {
if(resultCode == RESULT_OK) {
MyCustomDialogFragment newPopup = new MyCustomDialogFragment();
newPopup.setMyClickListener(MainActivity.this);
FragmentManager fragmentManager = getSupportFragmentManager();
newPopup.show(fragmentManager, "CashReceivePopup");
}
}
}
Here is the error:
01-04 05:08:57.010 13609-13609/com.nazmul.aznazgame.bitlife
D/AndroidRuntime: Shutting down VM 01-04 05:08:57.068
13609-13609/com.nazmul.aznazgame.bitlife E/AndroidRuntime: FATAL
EXCEPTION: main
Process: com.nazmul.aznazgame.bitlife, PID: 13609
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=4, result=-1, data=Intent { (has extras)
}} to activity
{com.nazmul.aznazgame.bitlife/com.nazmul.aznazgame.bitlife.MainActivity}:
java.lang.IllegalStateException: Can not perform this action after
onSaveInstanceState
at android.app.ActivityThread.deliverResults(ActivityThread.java:3574)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3617)
at android.app.ActivityThread.access$1300(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1352)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Caused by: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:2053)
at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:2079)
at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:678)
at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:632)
at android.support.v4.app.DialogFragment.show(DialogFragment.java:143)
at com.nazmul.aznazgame.bitlife.MainActivity.showEducationDialog(MainActivity.java:1716)
at com.nazmul.aznazgame.bitlife.MainActivity.manageActivity(MainActivity.java:604)
at com.nazmul.aznazgame.bitlife.MainActivity.onActivityResult(MainActivity.java:580)
at android.app.Activity.dispatchActivityResult(Activity.java:6192)
at android.app.ActivityThread.deliverResults(ActivityThread.java:3570)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3617) 
at android.app.ActivityThread.access$1300(ActivityThread.java:151) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1352) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:135) 
at android.app.ActivityThread.main(ActivityThread.java:5254) 
at java.lang.reflect.Method.invoke(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:372) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)  01-04
05:08:59.825 13609-13651/com.nazmul.aznazgame.bitlife
I/CrashlyticsCore: Crashlytics report upload complete:
5C2EEA4F018E-0001-3529-63E978D09744 01-04 05:08:59.955
13609-13609/com.nazmul.aznazgame.bitlife I/Process: Sending signal.
PID: 13609 SIG: 9

You must call super.onActivityResult(requestCode, resultCode, data) before doing any FragmentTransactions in your onActivityResult() method as that call is what 'unlocks' the FragmentManager and notes that you are in a valid state to do FragmentTransactions.
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// Add this line
super.onActivityResult(requestCode, resultCode, data);
// This all remains the same
if (requestCode == 1) {
if(resultCode == RESULT_OK) {
MyCustomDialogFragment newPopup = new MyCustomDialogFragment();
newPopup.setMyClickListener(MainActivity.this);
FragmentManager fragmentManager = getSupportFragmentManager();
newPopup.show(fragmentManager, "CashReceivePopup");
}
}
}

It is a common problem. You have 2 options how to deal with this issue.
you can override the show() method and put its content inside a try-catch block
You display the dialog in the followong way
FragmentManager fm = getSupportFragmentManager();
MyDialog d = new MyDialog();
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.add(d, "dialog");
ft.commitAllowingStateLoss();

Related

Null pointer exception in Android - onActivityResult()

What is causing this null pointer exception when I try and get the String I set as an extra? I've read a lot of the other questions on here and can't work it out.
I'm passing a String to the intent, which I got from an enum using the .name() method in the onOKButtonClicked method:
public void onSquareButtonClicked(View v)
{
brushStyle = Paint.Cap.SQUARE;
TextView currentBrushText = (TextView)findViewById(R.id.currentBrush);
currentBrushText.setText("SQUARE");
}
public void onRoundButtonClicked(View v){
brushStyle = Paint.Cap.ROUND;
TextView currentBrushText = (TextView)findViewById(R.id.currentBrush);
currentBrushText.setText("ROUND");
}
public void onOkButtonClicked(View v){
Intent intent = new Intent();
String stringBrushStyle = brushStyle.name();
intent.putExtra("new brush", stringBrushStyle);
setResult(Activity.RESULT_OK, intent);
finish();
}
}
And then trying to get the result back out here:
protected void onActivityResult(int requestCode, int resultCode,
#Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
FingerPainterView myFingerPainter = (FingerPainterView)findViewById(R.id.fingerPainterView);
if(resultCode != RESULT_CANCELED) {
if (requestCode == COLOR_REQUEST_CODE ) {
int currentColor = data.getIntExtra("new color", 5);
myFingerPainter.setColour(currentColor);
} else if (requestCode == BRUSH_REQUEST_CODE) {
String currentBrush = getIntent().getExtras().getString("new brush");
myFingerPainter.setBrush(Paint.Cap.valueOf(currentBrush));
}
}
}
}
My Logcat - not sure what who=null means here, but I'm guessing that's what is causing the problem:
Process: com.example.myapplication, PID: 17757
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=2, result=-1, data=Intent { (has extras) }} to activity {com.example.myapplication/com.example.myapplication.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.os.BaseBundle.getString(java.lang.String)' on a null object reference
at android.app.ActivityThread.deliverResults(ActivityThread.java:4089)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4132)
at android.app.ActivityThread.-wrap20(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1533)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.os.BaseBundle.getString(java.lang.String)' on a null object reference
at com.example.myapplication.MainActivity.onActivityResult(MainActivity.java:90)
at android.app.Activity.dispatchActivityResult(Activity.java:6932)
at android.app.ActivityThread.deliverResults(ActivityThread.java:4085)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4132) 
at android.app.ActivityThread.-wrap20(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1533) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6119) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) 
change the following line
String currentBrush = getIntent().getExtras().getString("new brush");
to
String currentBrush = data.getStringExtra("new brush");

onActivityResult should call super.onActivityResult

I am new to Android Studio and trying to create a simple app. The app keeps crashing, when I need to save the data from the other activities, using onActivityResult:
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == 1) {
if (resultCode == RESULT_OK) {
Job updatedJobDetails = (Job)data.getSerializableExtra("updatedJobDetails");
int position = data.getIntExtra("pos", -1);
adapter.remove(adapter.getItem(position));
adapter.insert(updatedJobDetails, position);
}
}
}
First it says, that I need to
onActivityResult should call super.onActivityResult
but when I do that, it crashes as soon as I use the method. Logcat:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.smapassignment01, PID: 6809
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=Intent { (has extras) }} to activity {com.example.smapassignment01/com.example.smapassignment01.MainActivity}: java.lang.ArrayIndexOutOfBoundsException: length=15; index=-1
at android.app.ActivityThread.deliverResults(ActivityThread.java:4360)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4402)
at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.ArrayIndexOutOfBoundsException: length=15; index=-1
at java.util.ArrayList.get(ArrayList.java:439)
at android.widget.ArrayAdapter.getItem(ArrayAdapter.java:393)
at com.example.smapassignment01.MainActivity.onActivityResult(MainActivity.java:122)
at android.app.Activity.dispatchActivityResult(Activity.java:7454)
at android.app.ActivityThread.deliverResults(ActivityThread.java:4353)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4402) 
at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49) 
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) 
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:193) 
at android.app.ActivityThread.main(ActivityThread.java:6669) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 
I/Process: Sending signal. PID: 6809 SIG: 9
Process 6809 terminated.
I can't really read from the logcat-report, what I've done wrong.
According to this SO-question it is because of getAdapterPosition - but I don't even use it, so I'm completely lost and have now used several hours, stuck.
UPDATE:
Just to show, that my pos has been sat in the other activity, from where the app crashes:
btnSaveNote.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
job.setUserNotes(etJobNotes.getText().toString());
if (!cbAppliedJob.isChecked()){
job.setJobApplied(false);
}
else{
job.setJobApplied(true);
}
Intent data = new Intent();
position = getIntent().getIntExtra("pos", -1);
data.putExtra("pos", position);
data.putExtra("updatedJobDetails", job);
setResult(RESULT_OK, data);
finish();
}
});

Android Studio Handover variables between activities

I´ve got one task. I have to put the points of a game from GameActivity to the GameOverActivity. I tried for hours, but it doesn´t work... Here is my try:
This is in my GameActivity (put an extra):
public void finishGameActivity(){
Intent i = getIntent();
i.putExtra("key1", points);
setResult(Activity.RESULT_OK, i);
finish();
}
And this is my GameOverActivity:
Bundle bundle = getIntent().getExtras();
int value = bundle.getInt("key1");
TextView points_stats = (TextView) findViewById(R.id.point_stats);
points_stats.setText(value);
The Application crashes. This is the error code:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: de.chralt.circlesafe, PID: 6849
java.lang.RuntimeException: Unable to start activity ComponentInfo{de.chralt.circlesafe/de.chralt.circlesafe.GameOverActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.os.Bundle.getInt(java.lang.String)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2691)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2752)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1461)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6120)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.os.Bundle.getInt(java.lang.String)' on a null object reference
at de.chralt.circlesafe.GameOverActivity.onCreate(GameOverActivity.java:26)
at android.app.Activity.performCreate(Activity.java:6664)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2644)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2752) 
at android.app.ActivityThread.-wrap12(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1461) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6120) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755) 
Where are you trying to extract the points in your GameOverActivity? Since you are calling "SetResult" it should be inside your GameOverActivity's onActivityResult method. If this is the case I believe it should look something like this:
#Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == Activity.RESULT_OK) {
// TODO Extract the data returned from the GameActivity.
int value = data.getIntExtra("key1", some_default_value);
}
}

Android get file path of image with in Fragment [duplicate]

This question already has answers here:
What is a NullPointerException, and how do I fix it?
(12 answers)
Closed 5 years ago.
I have an app and I need to take photos and then upload it to firebase. I basically need Uri path of the photo taken.
I read Get file path of image on Android, but I have a problem with NullPointerException.
Main difference between my problem and the problem above is that I'm doing it in a Fragment.
Here is my code:
mTakePhotoButton.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, CAMERA_REQUEST);
}
});
I get NullPointerException in line with Uri imgUri.
#Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == CAMERA_REQUEST && resultCode == Activity.RESULT_OK) {
Bitmap photo = (Bitmap) data.getExtras().get("data");
mImgView.setImageBitmap(photo);
Uri imgUri = getImageUri(getActivity().getApplicationContext(), photo);
mManager.setPhotoUri(imgUri);
}
}
And here is the method I use to get Uri.
private Uri getImageUri(Context inContext, Bitmap inImage) {
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
inImage.compress(Bitmap.CompressFormat.JPEG, 100, bytes);
String path = MediaStore.Images.Media.insertImage(inContext.getContentResolver(), inImage, "Title", null);
return Uri.parse(path);
}
The exact error message is:
java.lang.RuntimeException: Failure delivering result
ResultInfo{who=android:fragment:1, request=22222, result=-1,
data=Intent { act=inline-data (has extras) }} to activity
{.MainActivity}:
java.lang.NullPointerException: uriString
I would appreciate any help.
The entire error log:
09-14 12:06:18.448 16497-16497/com.example.radzik.recipes E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.radzik.recipes, PID: 16497
java.lang.RuntimeException: Failure delivering result ResultInfo{who=android:fragment:1, request=22222, result=-1, data=Intent { act=inline-data (has extras) }} to activity {com.example.radzik.recipes/com.example.radzik.recipes.activity.MainActivity}: java.lang.NullPointerException: uriString
at android.app.ActivityThread.deliverResults(ActivityThread.java:3699)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3742)
at android.app.ActivityThread.-wrap16(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1393)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.NullPointerException: uriString
at android.net.Uri$StringUri.(Uri.java:475)
at android.net.Uri$StringUri.(Uri.java)
at android.net.Uri.parse(Uri.java:437)
at com.example.radzik.recipes.fragment.ChoosePhotoFragment.getImageUri(ChoosePhotoFragment.java:144)
at com.example.radzik.recipes.fragment.ChoosePhotoFragment.onActivityResult(ChoosePhotoFragment.java:135)
at android.app.Activity.dispatchActivityResult(Activity.java:6452)
at android.app.ActivityThread.deliverResults(ActivityThread.java:3695)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3742) 
at android.app.ActivityThread.-wrap16(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1393) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:148) 
at android.app.ActivityThread.main(ActivityThread.java:5417) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
Your problem is with getActivity() becasue you are getting the intent of the current activity you were on which will fail.
So if you move your code to the OnActivityResult this will make it work.
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
//first call super
super.onActivityResult(requestCode, resultCode, data);
//rest of your code
}
Don't forget to add
<uses-permission android:name="android.permission.CAMERA" />
and/or without depends on your app
<uses-feature android:name="android.hardware.camera" />

startActivityForResult force closes my app

I wanted to make two buttons on my main activity to startActivityForResult
Every time I press either of these buttons my app force closes , and I can't figure out why!
Here is the code of the two buttons :
public void billiards (View v)
{
Intent billiards = new Intent(this,Billiards.class);
startActivityForResult(billiards,99710);
}
public void snooker (View v)
{
Intent snooker = new Intent(this,Snooker.class);
startActivityForResult(snooker,99711);
}
Here is the code of Billiards activity :
public void bsave (View v)
{
Double dbgames = Double.parseDouble(ebgames.getText().toString());
Double calcbgames = (dbgames)*0.50;
Double btotal = (calcbgames);
Intent billiards=new Intent();
billiards.putExtra("btot",String.valueOf(btotal));
setResult(99710,billiards);
finish();
}
Here is the code of Snooker Activity :
public void ssave (View v)
{
Double dsgames = Double.parseDouble(esgames.getText().toString());
Double calcsgames = (dsgames)*1.00;
Double stotal = (calcsgames);
Intent snooker=new Intent();
snooker.putExtra("stot",String.valueOf(stotal));
setResult(99710,snooker);
finish();
}
And here is the code of onActivityResult in my MainActivity :
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode==99710) {
if (resultCode == RESULT_OK) {
String billiardstot = data.getStringExtra("btot");
String bt = billiardstot;
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putString(BToatal, bt);
editor.commit();
} else if (resultCode == RESULT_CANCELED) {
Toast.makeText(getApplicationContext(), "Wrong Request Code", Toast.LENGTH_LONG).show();
}
}
if (requestCode==99711) {
if (resultCode == RESULT_OK) {
String snookertot = data.getStringExtra("stot");
String st = snookertot;
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putString(STotal, st);
editor.commit();
} else if (resultCode == RESULT_CANCELED) {
Toast.makeText(getApplicationContext(), "Wrong Result Code", Toast.LENGTH_LONG).show();
}
}
}
Whenever i press on Billiards or Snooker Buttons the app force closes
And here is the LogCat :
08-18 02:11:01.220 11972-11972/cafe.al_sheikhabuhamzehcafe E/AndroidRuntime: FATAL EXCEPTION: main
Process: cafe.al_sheikhabuhamzehcafe, PID: 11972
java.lang.IllegalStateException: Could not execute method for android:onClick
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:293)
at android.view.View.performClick(View.java:5198)
at android.view.View$PerformClick.run(View.java:21147)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:288)
at android.view.View.performClick(View.java:5198) 
at android.view.View$PerformClick.run(View.java:21147) 
at android.os.Handler.handleCallback(Handler.java:739) 
at android.os.Handler.dispatchMessage(Handler.java:95) 
at android.os.Looper.loop(Looper.java:148) 
at android.app.ActivityThread.main(ActivityThread.java:5417) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
Caused by: java.lang.IllegalArgumentException: Can only use lower 16 bits for requestCode
at android.support.v4.app.BaseFragmentActivityEclair.checkForValidRequestCode(BaseFragmentActivityEclair.java:64)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:868)
at cafe.al_sheikhabuhamzehcafe.ItemMenu.billiards(ItemMenu.java:149)
at java.lang.reflect.Method.invoke(Native Method) 
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:288) 
at android.view.View.performClick(View.java:5198) 
at android.view.View$PerformClick.run(View.java:21147) 
at android.os.Handler.handleCallback(Handler.java:739) 
at android.os.Handler.dispatchMessage(Handler.java:95) 
at android.os.Looper.loop(Looper.java:148) 
at android.app.ActivityThread.main(ActivityThread.java:5417) 
at java.lang.reflect.Method.invoke(Native Method) 
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
08-18 02:11:03.043 11972-11972/cafe.al_sheikhabuhamzehcafe I/Process: Sending signal. PID: 11972 SIG: 9
java.lang.IllegalArgumentException: Can only use lower 16 bits for requestCode
the values you are using for your requestCode are too large
stick to something less than ‭65535‬

Categories

Resources