SyncResultReceiver$TimeoutException crashing Android a lot - java

I've disabled all autofill with View.AUTOFILL_TYPE_NONE
com.android.internal.util.SyncResultReceiver$TimeoutException:
at com.android.internal.util.SyncResultReceiver.waitResult (SyncResultReceiver.java:60)
at com.android.internal.util.SyncResultReceiver.getIntResult (SyncResultReceiver.java:68)
at android.view.autofill.AutofillManager.ensureServiceClientAddedIfNeededLocked (AutofillManager.java:1831)
at android.view.autofill.AutofillManager.notifyViewEnteredLocked (AutofillManager.java:956)
at android.view.autofill.AutofillManager.notifyViewEntered (AutofillManager.java:940)
at android.view.autofill.AutofillManager.notifyViewEntered (AutofillManager.java:897)
at android.view.View.notifyEnterOrExitForAutoFillIfNeeded (View.java:7972)
at android.view.View.onFocusChanged (View.java:7934)
at android.widget.TextView.onFocusChanged (TextView.java:10801)
at android.view.View.handleFocusGainInternal (View.java:7597)
at android.view.View.requestFocusNoSearch (View.java:12962)
at android.view.View.requestFocus (View.java:12936)
at android.view.View.requestFocus (View.java:12903)
at android.view.View.requestFocus (View.java:12845)
at android.view.View.onTouchEvent (View.java:15336)
I am not sure what is wrong.
It only happens to Android 10 devices.
This happens when I click on an EditText the app crashes and restarts.

I've solved my problem with similar crash on click on edittext, by rename of variable named "userId"
I'm still not shure why this magic works, but try to rename such variables with common names

Related

How to create a Lottie Alert Dialog in Java

I've tried searching for the Java tutorial regarding creating my LottieAlertDialog, but I can't find any. Everywhere it's in Kotlin, but I need the Java code as my project is in Java.
I've tried creating my LottieAlertDialog in this way:
LottieAlertDialog.Builder alert=new LottieAlertDialog.Builder(context,DialogTypes.TYPE_CUSTOM,
"social.json") //Here social.json is inside assets folder
.setTitle("Social")
.setDescription("social");
alert.build();
But the dialogbox doesn't show, when I run the app. To check whether my alert dialogbox was being created or not I tried testing it by printing the description set in the dialog in a Toast:
Toast.makeText(context,alert.getDescription(),Toast.LENGTH_SHORT).show();
The toast works and its showing "social"! That means the dialog is being created. But unfortunately it doesn't show in my app. What do I do? I've implemented all the dependencies as shown in the below link:
lottiealertdialog
Ok, after much hankering, I finally came to the solution. It's
alert.build().show();
The thing is not related to Kotlin or Java as such, you need to show the dialog once you have built it. So far your code is correct. You just need to show it further like this
LottieAlertDialog.Builder alert = new LottieAlertDialog.Builder(context, DialogTypes.TYPE_CUSTOM,
"social.json")
.setTitle("Social")
.setDescription("Social")
.build()
.show();

How to change a photo?

I am trying to change photos in android studio by clicking on my button.
When I put code for changing the photo in my MainActivity.java I keep getting this type of error messages and it says :
Cannot resolve symbol "image"
image.setImageResource(R.drawable.xxx);
I am watching Udemy course for android development and I have done everything same like the professor on that video.
I have tried to restart android studio.
I have tried to make new project.
I have tried to clear invalidate caches and restart.
public void changeImage(View view)
{
ImageView bitcoin = findViewById(R.id.bitcoin);
image.setImageResource(R.drawable.xxx);
}
I hope there is actual error with android studio,because code is clone of the video that I am watching.
You are binding your layout's ImageView in Java file with bitcoin variable and you are trying to set an image on an unknown variable 'image'(maybe it's not defined in the class). So you have to set as below.
ImageView bitcoin = findViewById(R.id.bitcoin);
bitcoin.setImageResource(R.drawable.xxx);
Set Your Code Like this
ImageView image = findViewById(R.id.bitcoin);
image.setImageResource(R.drawable.xxx);
change your this line
image.setImageResource(R.drawable.xxx)
to this one:
bitcoin.setImageResource(R.drawable.xxx)

Android Studio - URL string

So I'm pretty new to the whole Android Studio thing and I've been using the internet to help me with a lot of the things I am doing and needed help on something.
I'm not sure if it's possible to connect this to either a string or an SQL database but I have a Main Layouts with a bunch of buttons that allow me to click on them and choose what external player I would like to use to watch the video. In my MainActivity java class, this is how it finds the button.
case R.id.button3:
intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse("http://videoname.mp4"), "video/*");
startActivity(Intent.createChooser(intent, "Choose an External Player"));
break;"
I wanted to know if "http://videoname.mp4" url can be connected to like a string where I can always update or change the URL instead of manually going to find the URL in the MainActivity java and changing it. As of now I have to manually do it but a different way to do it would be helpful.
I'm sorry if it's all confusing, but if you know, please let me know as soon as.
Thank you.
you just need write your string URL :
open your directory folder /res/values/strings.xml -> write your string : <string name="yourStringName>yourStringURL</string>. to use your string do this
getContext().getString(R.string.yourStringName) in fragment
getString(R.string.yourStringName) in Activity
or you can write directly on your code, put your cursor on your string, then press key alt + enter choose extract string resource fill the resource name with your string name
wherever you need to use it, just do point 1 or 2. also in your Intent
hope this help you, never stop learning!
Add it to strings.xml in your project. That is the recommended way of using strings anyway.

Tetris has stopped working

I'm making tetris in Android via eclipse (I use an emulator of eclipse). The program worked untill I added a bunch of stuff (maybe wasn't so smart, but nothing visual was changed so) I didn't run the progam in a while. Now I can go to my first activity, but as soon as I click the button to go to my next one, the program stops working :(
Here is my code:
MainActivity.java http://pastebin.com/P9AAJ90n (button towards Tetris.java)
Tetris.java http://pastebin.com/WEsXshPh (probably contains error)
TetrisView.java http://pastebin.com/ejUJjLMk
I think that's the code the problem is located in, but do ask for more if required...
(I think the problem is located in the onCreate() method of Tetris.java
Now the LogCat Debug text:
http://pastebin.com/MSCxHdsr
Thanks in advance
PS: If I remove the whole onCreate() of Tetris.java except the first 2 lines, I can run the program.
-----------------------------------------------EDIT-----------------------------------------------
I removed one of the setContentView(), still stops working. Also looked into DroppedTiles, thought I fixed it but didn't :(
Logcat: http://pastebin.com/JHu7n1uA
DroppedTiles: http://pastebin.com/tyKLuxVd
Block: http://pastebin.com/zmPa7cv7
I commented the DroppedTiles in Tetris.java...
Tried reading the debug log but most of it I do not understand sadly
you're setting content view twice
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tetris);
// Intent intent = getIntent();
// Add mTetrisView to this
mTetrisView = new TetrisView(this, null);
setContentView(mTetrisView);
mTetrisView.init();
figure out which is the correct one (probably the first) and remove the other.

Hiding and showing Eclipse view programmatically

I am showing and hiding Eclipse view with code below. It works perfectly with Eclipse 3.3, but with Eclipse Juno (version 4.3) it's not showing the first time but showing when I fire the event for the second time.
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getActivePage();
page.showView(UserView.ID);
page.hideView(page.findView(UserView.ID));
Is somebody come across with this situation before?
I am not sure why you are not getting it the first time. Check to see if you dont have null pointer errors when you fire it the first time.
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
can return a null if the workbench is not yet loaded.
I faced the same issue with the minimized state, so I tried chaging the view's state forcing it to appear after page.showView(UserView.ID);
this piece of code got my viewPart to show :
page.showView(UserView.ID);
IWorkbenchPartReference ref = page.getReference(searchResultUI);
page.setPartState(ref,IWorkbenchPage.STATE_RESTORED); //or STATE_MAXIMIZED

Categories