|
Ah! Then I must say thank you.
Eric
|
|
|
|
|
|
Hy !
Im working on a tic tac toe game ..
when i press a button I check if the button is free if is free i set the buttons backround to an X.. with :
btn.setBackgroundResource(R.drawable.xpic);
afther this i call a method wich is the "Computer Turns" methot .. now my question is :
Is there any solution to set the picture bifore the mobile phone reach to en of code in "OnClick" ?
for example:
btn.setBackgroundResource(R.drawable.xdraw);
if(checkifwinner()) return;
turn++;
computerTurm();
there is a lot of code in the checkifwinner() because if wins then comes up a dialog.. and i dont want to wait till the dialog pups up.. how can i resolve this problem ?
Thanks a Lot.
|
|
|
|
|
i want to make a app which shows desktop of pc on my android phone, so what should i do?.. i don't know how i can send and receive data request for sharing of a servers desktop on the clients(i.e. phone) screen.
|
|
|
|
|
I'm developing an app for my tablet that is to turn on the screen when I rotate it to the vertical (the power switch is dodgy). It has an optimization to turn off the sensor from 22:00 to 06:30. The app works most of the time. However sometimes it fails. For example this morning I picked it up at 07:10 and the screen came on as expected. I put it down for about a half an hour and when I picked it up again it did not come on. I plugged in the power and it came on. I stopped my service and restarted it then and it has been running fine: pick up and it comes on when the screen has gone off.
Looking at the logs I see that the system stops the service frequently(maybe every 30 minutes) and then restarts it, passing a null intent to the onStartCommand() method. I've used SharedPreferences to save the app's state and am able to successfully restart the app where it needs to be.
My question: why didn't the app work this morning after it had worked on the first pickup of the morning? Any ideas on how to debug this or any work-arounds?
It's a very elusive bug. The code works so many times and fails so few times that I'm not able to come up with a debugging scheme to find out a reason or pattern for the failure.
Do you have any suggestions?
Something I've observed by looking at the logs is that the system restarts my service (passing a null intent to the onStartCommand() method) very soon after I have plugged in the tablet to turn on the screen. How would a bug in my code cause that?
Another observation: the system often restarts my service 5 seconds after the AlarmReceiver is supposed to receive an alarm: at 22:00:05 for an alarm set for 22:00:00.
Also posted at: http://www.codeproject.com/Questions/826395/Service-not-always-restarted-on-ASUS-tablet?cmt=683080#cmt2_826395
|
|
|
|
|
Quote: the system stops the service frequently(maybe every 30 minutes) and then restarts it, passing a null intent to the onStartCommand() method Instead of returning START_STICKY from onStartCommand try returning START_REDELIVER_INTENT . This will ensure that the system redelivers the initial Intent that was passed to the service when the service was started.
|
|
|
|
|
Thanks for the response. The null intent is not the problem. The code saves the data from the original intent and uses the startId value to recognize that is has been restarted.
The problem is that my service is NOT being restarted promptly or some times not at all.
|
|
|
|
|
As you have mentioned that it is being killed frequently, it seems that the device is running low on resources and in such a case the system will not restart the Service until adequate resources are available.
Try running the service in Foreground and see if it helps.
However, if your device is running Android 4.4.2 then it's a known issue - https://code.google.com/p/android/issues/detail?id=63793[^]
|
|
|
|
|
Thanks again. The link has some good ideas. My tablet is running version 4.3
I do use startForeground() method and it shows a Notification.
The frequency of being stopped was almost exactly every 30 minutes.
The times of some of the restarts are 5 seconds after an Alarm is supposed to go off and send an Intent to my service.
modified 16-Oct-14 14:55pm.
|
|
|
|
|
hi i want to develop an mobile application using android and i don't know where to start can anyone please help by sending me simple code to practise
|
|
|
|
|
|
Member 11116727 wrote: ...and i don't know where to start... Try here.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
|
Are you intending to use Java (and write a native app) or use a cross-platform tool such as Xamarin?
If you are opting for the latter then read my introductory article Introduction to Xamarin.Android[^]
|
|
|
|
|
this is my dialog
@Override
protected Dialog onCreateDialog(int id, Bundle args){
switch(id){
case 1:
return new AlertDialog.Builder(this)
.setIcon(R.drawable.ic_launcher)
.setTitle("Pick some")
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int whichButton)
{
}
})
.setNegativeButton("cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int whichButton)
{
}
})
.setMultiChoiceItems(items, itemsChecked, new DialogInterface.OnMultiChoiceClickListener() {
public void onClick(DialogInterface dialog, int which,boolean isChecked) {
}
}
)
.create();
How can I detect when the dialog is load ?
i need to do something when the dialog is up and see it on the screen
* this is a multi-checkbox dialog, and i need to uncheck all.
thanks
modified 4-Oct-14 6:24am.
|
|
|
|
|
|
I just wrote what I tried. May have been wrong and that is not the way, that's why I turned to for help
|
|
|
|
|
OK, but you have an error message telling you what you have done wrong. You need to fix that before you can proceed.
|
|
|
|
|
I tried a few things but still not working
I have been really desperate, do not know how to solve it
|
|
|
|
|
Have you corrected the coding error that I pointed out to you? Or do you have some new problem?
|
|
|
|
|
no errors, i update my question.
|
|
|
|
|
|
goldsoft wrote: How can I detect when the dialog is load ? i need to do something when the dialog is up and see it on the screen Without more information as to your need/intent, this goes against Android's asynchronous (i.e., non-blocking) interface.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
thanks for the help,
what i need to do is uncheck all my multi checkBoxs
that i have in the dialog.
when i press the button and the dialog came up -
i need to uncheck all my checkBoxs
|
|
|
|
|
Hai there,
I have drawn a circle using canvas bitmap by taking linear layout, Now I want to swipe that circle so as to draw another circle in the same xml file and display.Kindly help!
|
|
|
|