GetActiveNotifications () method how use it to find a package? - java

I know i can use this method: GetActiveNotifications() to get the active notifications in my notifications bar but i don't know why.. What i want exactly is check if a package name is present or not so then i can make a condition to read the notifications of specify app. I can get the package name in this way:
Log.i(TAG,"Package Name" + sbn.getPackageName());
but the problem is create the right method with all informations. Can anyone help me? Thanks

Related

TelegramBots Java API - Get Chat object from CallbackQuery getChatInstance method

Is there a way to retrieve the chat id from a CallbackQuery object?
In my case, I have made a InlineKeyboardButton and set a callbackQueryData.
I'm able to retrieve this callback query but without chance to retrieve the chat id. I know the answerInlineQuery method but I dont need in my case. I need only a way to retrieve the chat id.
CallbackQuery class provide the getChatInstance() method but return always null.
Anyone can help me?
Thank you
SOLUTION FOUND
CallbackQuery callbackQuery;
Long chatId = callbackQuery.getMessage().getChatId();

Why this particular code generates "ambiguous method call" error in Android Studio?

I use iText 5 in Android Studio to create a PDF document but I get an error:
I also tried
p.add((Phrase)c);
but I get same error :-(
How I can get rid of this error?
"ambiguous" error comes up when u already have a file/varibale etc with same name.
for example when you make a project using entity framework , entity framework make class and dbcontext files for u. but if u add a class with same name as entity framework had made for u then this error comes up. check ur project/programe correctly and fully again...
Hope its helpfull !!
and checkout this link for ur answer Android Studio - Ambiguous method call getClass()
thanks for reply - indeed I needed help regarding why 'ambiguous' appears in this context.
But now the problem is solved - this error does not appear anymore - but I don't know exactly why.
I did some Android Studio updates last week may this helped?
Thanks anyway!
In case when we use data binding, some java files are auto-generated
The problem was occured when a getter/setter has the same name with a function.
eg
var newData
fun getNewData()
in this case, in the generated java file, the variable's getter has the same name with the function => getNewData.
So simply you have to change variable name or fuction name

How to hit the rest endpoint that has `:.*` as a part of the path param field

I am using the Stash's REST API in my project. My task is to get the tag details for a specific tag. After checking the Stash's REST API documentation, I found the correct endpoint that I should be using. It is
/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/tags/{name:.*}
Please see this link for the Stash's REST API documentation.
There is one more endpoint /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/tags
With this endpoint I am able to retrieve all the tags. The StashTag object looks something like this.
{
"id": "refs/tags/v4.0.0",
"displayId": "v4.0.0",
"latestChangeset": "234dadf41742cfc2a10cadc7c2364438bd8891c5",
"latestCommit": "234dadf41742cfc2a10cadc7c2278658bd8891c5"
"hash" : "null"
}
My first problem is, I don't know which field to use as the parameter for {name:.*}. Should it be the displayId or Id or anything else.
The second problem is, I don't understand what it means to have : (colon) followed by a . (dot) in the endpoint /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/tags/{name:.*}.
Can someone explain me what is the purpose of :. in the path param and how to hit this kind of an endpoint. Also an example of the complete endpoint would be nice.
So far I have tried hitting
https://stashtest.abc.com/rest/api/1.0/projects/KARTIK/repos/kartiks-test-repository/tags/v4.0.0
https://stashtest.abc.com/rest/api/1.0/projects/KARTIK/repos/kartiks-test-repository/tags/refs/tags/v4.0.0
None of these endpoints work.
Any help is appreciated.
The {name:.*} is really just saying that the field name can be anything. Chalk this one up to poor documentation on their part. Think of it like Regex field, because that's exactly what it is. I'm sure at one point they had something like ^[0-9] then went back and changed it when they realized using only tag numbers would omit anyone using their lightweight tag features.
Remove the v from your tag version and see if that helps. If it does not, I would also recommend creating a lightweight tag (something like mytag) and seeing if you can hit it that way (i.e., /kartiks-test-repository/tags/mytag).
But looking at that documentation is telling me that your v in your tag name is throwing off the REST call.

Appium driver to get app package name programmatically

I am using:
appiumDriver.findElement(By.id("com.XXX.keyword:id/nextButton"));
but sometimes we have debug version, so we have something like "com.XXX.keyword.debug". So I want to get package name before test runs so the tests can be independent on this.
I tried
driver.currentActivity()
but it only returned something like ".MainActivity"
Is there any way to get package name with Appium?
Thanks a lot.
You don't need package name to locate elements. Simply copy paste id without package name . eg in your case use only 'nextButton' instead of 'com.XXX.keyword:id/nextButton'
To get the current package name use following method:
driver.getCurrentPackage();
The following statement you are using will give you Activity Name.
driver.currentActivity();

Java error: Context already contains a binding with name ""

Ok so I have followed this tutorial step by step: Custom Java Desktop Database Application
I can't understand what I'm doing wrong but when I run the application and click on "New Customer" i get the following error:
Caused by: java.lang.IllegalArgumentException: Context already contains a binding with name ""
I believe that it has something to do with the combobox which is binded with the countries list which comes from the database. The binding expression is set to null and binding source is set to countriesList.
Any help would be appreciated guys?
Thanks
SOLVED
When binding elements of the combo box, in the advanced tab, I just set the name to "null"..and it started working.
while giving "null" into Identification's name works, it only works for the second occurance, you may not repeat the "null" string as the name for the third or any other occurances.
Because,
actually the only one we need to remember is, the name needs to be unique. That's all :)
It seems something was changed in Netbeans. The bindings don't need a name, but for some reason Netbeans started adding "" as the name of many bindings. My solution has been to open the .java file in another editor and just removing the last , "" in the createAutoBinding method call.

Categories

Resources