Search Results

Search found 254200 results on 10168 pages for 'activity stack'.

Page 6/10168 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • updating an activity from an asynchronous service

    - by Dave.B
    I've implemented a service that does an asynchronous sync to between my application and google docs. I want to update the top level activity of my application when the sync is complete. However because of the service it's possible that the app could be be in a unknown state. Is there a way to make the top level activity, whatever that may be, recreate itself from an asynchtask in a service.

    Read the article

  • Make service indepented from activity (Android).

    - by shuwo
    I have an activity with two buttons, start and stop. If the user press the start button a service is created using Context.startService. And the stop button calls Context.stopService. I want the stop button to be the only way to destroy the service. Now, if i end the activity using a task manager, the service is killed as well. Is there any way to avoid this?

    Read the article

  • Android reset activity component state on navigation back

    - by Aure77
    I have 2 activities in my application. In activity1, I set some configuration and I modify the state of some component (ex: set button state disabled). And I navigate to activity2. In activity2 I do some stuff and at end, I finish this activity and come back to activity1. But In activity1, my components state are the same when I leave this activity. How to reset the components state with valuesdeclared in XML file (layout) ?

    Read the article

  • C++, using stack.h read a string, then display it in reverse

    - by user1675108
    For my current assignment, I have to use the following header file, #ifndef STACK_H #define STACK_H template <class T, int n> class STACK { private: T a[n]; int counter; public: void MakeStack() { counter = 0; } bool FullStack() { return (counter == n) ? true : false ; } bool EmptyStack() { return (counter == 0) ? true : false ; } void PushStack(T x) { a[counter] = x; counter++; } T PopStack() { counter--; return a[counter]; } }; #endif To write a program that will take a sentence, store it into the "stack", and then display it in reverse, and I have to allow the user to repeat this process as much as they want. The thing is, I am NOT allowed to use arrays (otherwise I wouldn't need help with this), and am finding myself stumped. To give an idea of what I am attempting, here is my code as of posting, which obviously does not work fully but is simply meant to give an idea of the assignment. #include <iostream> #include <cstring> #include <ctime> #include "STACK.h" using namespace std; int main(void) { auto time_t a; auto STACK<char, 256> s; auto string curStr; auto int i; // Displays the current time and date time(&a); cout << "Today is " << ctime(&a) << endl; s.MakeStack(); cin >> curStr; i = 0; do { s.PushStack(curStr[i]); i++; } while (s.FullStack() == false); do { cout << s.PopStack(); } while (s.EmptyStack() == false); return 0; } // end of "main" **UPDATE This is my code currently #include <iostream> #include <string> #include <ctime> #include "STACK.h" using namespace std; time_t a; STACK<char, 256> s; string curStr; int i; int n; // Displays the current time and date time(&a); cout << "Today is " << ctime(&a) << endl; s.MakeStack(); getline(cin, curStr); i = 0; n = curStr.size(); do { s.PushStack(curStr[i++]); i++; }while(i < n); do { cout << s.PopStack(); }while( !(s.EmptyStack()) ); return 0;

    Read the article

  • Stack overflow in xp cmd console

    - by Dave
    I am using an older program whose source code I cannot see. I am using the cmd.exe console in windows xp. The program ran with no problems on an xp machine last year, while a stack overflow code 2000 error was observed on a different xp machine (easy fix - use the machine that works). I tried running the program on the previously working machine lately, and now am getting the same error. No changes to the os were made and I did not change the service pack version. Any ideas on how to get around this stack overflow error so I can use the program? Dosbox will at least open the program, however it does not run to completion. Thanks!

    Read the article

  • please assist me debug a stack trace

    - by Eds
    I am having an issue on a windows 2003 terminal server, where the system process is using a constantly high amount of CPU. I believe that it is the srv.sys that is causing an issue, but not quite sure how to fully diagnose the problem. I have looked at the stack for the srv.sys!workerthread, which is what seems to be using the CPU. The stack is as follows: 0 ntoskrnl.exe!KeSetBasePriorityThread+0xf7 1 ntoskrnl.exe!MiDeleteAddressesInWorkingSet+0x103 2 srv.sys!WorkerThread+0x7c 3 ntoskrnl.exe!FsRtNotifyFilterReportChange+0x10 4 ntoskrnl.exe!RtClearBits+0x24 Can anyone offer any advice based on the above, or some other things I could look at in order to get to the bottom of this? Many Thanks, Eds

    Read the article

  • How to keep activity on Force Close?

    - by SushiRoll
    I have this piece of code that's really prone to errors so I wrapped it with try{}catch statement. I don't want to go back to the previous activity, I just want it to stay on the current activity so that the user can edit whatever is wrong with them. How do I implement this? try{ orgi.insertOrThrow(tableName, null, values); Toast.makeText(this, "You have successfully created a new profile!", 2).show(); gotoProfileList(); Log.e(getClass().getSimpleName(),"Successfully added to database"); }catch(SQLiteException se){ Log.e(getClass().getSimpleName(), "Database connection failed!" + se); //Stay in this activity... }finally{ if (orgi != null){ orgi.close(); } } Forget it, I was able to solve my own problem by showing up an alertDialog that tells the user about the error. Thanks anyways. :) try{ orgi.insertOrThrow(tableName, null, values); Toast.makeText(this, "You have successfully created a new profile!", 2).show(); gotoProfileList(); Log.e(getClass().getSimpleName(),"Successfully added to database"); }catch(SQLiteException se){ Log.e(getClass().getSimpleName(), "Database connection failed!" + se); displayError(); //stayInThisActivity(); }finally{ if (orgi != null){ orgi.close(); } public void displayError(){ AlertDialog.Builder error = new AlertDialog.Builder(this); error.setMessage("That profile name already exists, try another one.").setCancelable(false).setPositiveButton("Yes",new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); AlertDialog alert = error.create(); alert.setTitle("Error"); alert.show(); }

    Read the article

  • Pass data from thread into Activity

    - by Laimoncijus
    Hi, I am want to pass data back from a Thread to Activity (which created the thread). So I am doing like described on Android documentation: public class MyActivity extends Activity { [ . . . ] // Need handler for callbacks to the UI thread final Handler mHandler = new Handler(); // Create runnable for posting final Runnable mUpdateResults = new Runnable() { public void run() { updateResultsInUi(); } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); [ . . . ] } protected void startLongRunningOperation() { // Fire off a thread to do some work that we shouldn't do directly in the UI thread Thread t = new Thread() { public void run() { mResults = doSomethingExpensive(); mHandler.post(mUpdateResults); } }; t.start(); } private void updateResultsInUi() { // Back in the UI thread -- update our UI elements based on the data in mResults [ . . . ] } } Only one thing I am missing here - where and how should be defined mResults so I could access it from both Activity and Thread, and also would be able to modify as needed? If I define it as final in MyActivity, I can't change it anymore in Thread - as it is shown in example... Thanks!

    Read the article

  • C++ stack for multiple data types (RPN vector calculator)

    - by Arrieta
    Hello: I have designed a quick and basic vector arithmetic library in C++. I call the program from the command line when I need a rapid cross product, or angle between vectors. I don't use Matlab or Octave or related, because the startup time is larger than the computation time. Again, this is for very basic operations. I am extending this program, and I will make it work as an RPN calculator, for operations of the type: 1 2 3 4 5 6 x out: -3 6 -3 (give one vector, another vector, and the "cross" operator; spit out the cross product) The stack must accept 3d vectors or scalars, for operations like: 1 2 3 2 * out: 2 4 6 The lexer and parser for this mini-calculator are trivial, but I cannot seem to think of a good way for creating the internal stack. How would you create a stack of for containing vectors or doubles (I rolled up my own very simple vector class - less than one hundred lines and it does everything I need). How can I create a simple stack which accepts elements of class Vector or type double? Thank you.

    Read the article

  • What happens on Activity.finish() with AsyncTask still running in background?

    - by stormin986
    What happens on Activity.finish() with an AsyncTask still running in background? Does it just pop the Activity off the Activity Stack, but wait to destroy the Activity object until the AsyncTask fully completes (since the AsyncTask is an inner class of my Activity)? Also, would it act any differently if the AsyncTask were a public, non-inner class that held no references to the instance of the Activity?

    Read the article

  • How to add a dynamically resolved activity name to the back stack (without using PARENT_ACTIVITY)?

    - by user3214249
    The goal is 1) Start activity A from AppWidgetProvider or any other background task (it is simple). 2) From activity A go to activity B after clicking Back button. The problem is that I can't set PARENT_ACTIVITY in AndroidManifest.xml, because the activity B class name gets determined at run time. So in one case I need to go to activity B, in other case it is another activity. Seems like I can't use TaskStackBuilder without PARENT_ACTIVITY. I could handle this in the finish() method of activity A, but it should be a simpler way to add activity B to the "back stack" when I run startActivity(intent). Any ideas?

    Read the article

  • How to do comments in Activity Stream? (like Facebook)

    - by fesja
    Hi, I'm starting to develop an activity stream. I've read both How to implement the activity stream in a social network and What’s the best manner of implementing a social activity stream?. What I haven't found is the best way to add comments to the activities. As in facebook, each comment can be commented by another person. If each activity comment is saved as another activity, then I would not be able to get the activity of that comment without doing a query. So the solution I'm thinking is to save the comments inside the serialize data field of each activity. If the user wants to delete his comment, I would have to update that activity. Is this the correct solution? Is there a better approach? Thanks!

    Read the article

  • Web service creates stack overflow

    - by mouthpiec
    I have an application that when executed as a windows application works fine, but when converted to a web service, in some instances (which were tested successfully) by the windows app) creates a stack overflow. Do you have an idea of what can cause this? (Note that it works fine when the web service is placed on the localhost). Could it be that the stack size of a Web Service is smaller than that of a Window Application? UPDATE The below is the code in which I am getting a stack overflow error private bool CheckifPixelsNeighbour(Pixel c1, Pixel c2, int DistanceAllowed) { bool Neighbour = false; if ((Math.Abs(c1.X - c2.X) <= DistanceAllowed) && Math.Abs(c1.Y - c2.Y) <= DistanceAllowed) { Neighbour = true; } return Neighbour; }

    Read the article

  • How to create a typed stack using Objective-C

    - by Xetius
    I can create a stack class quite easily, using push and pop accessor methods to an NSArray, however. I can make this generic to take any NSObject derived class, however, I want to store only a specific class in this stack. Ideally I want to create something similar to Java's typed lists (List or List) so that I can only store that type in the stack. I can create a different class for each (ProjectStack or ItemStack), but this will lead to a more complicated file structure. Is there a way to do this to restrict the type of class I can add to a container to a specific, configurable type?

    Read the article

  • How can I reverse a stack?

    - by come pollinate me
    I need to write a VB.NET code to reverse the given characters using a stack. Input: 'S','T','A','C','K' So far I have input the letters, but I don't know how to get the console to reverse it. I'm a beginner to programming so please excuse my ignorance. An explanation as to how it's done would also be greatly appreciated. What I got so far. Module Module1 Sub Main() Dim StackObject As New Stack StackObject.Push("S") Console.WriteLine(StackObject.Peek) StackObject.Push("T") Console.WriteLine(StackObject.Peek) StackObject.Push("A") Console.WriteLine(StackObject.Peek) StackObject.Push("C") Console.WriteLine(StackObject.Peek) StackObject.Push("K") Console.WriteLine(StackObject.Peek) End Sub End Module I just need it to be reversed. I got it!! Module Module1 Sub Main() Dim StackObject As New Stack StackObject.Push("S") StackObject.Push("T") StackObject.Push("A") StackObject.Push("C") StackObject.Push("K") For Each cur As String In StackObject Console.WriteLine(cur) Next End Sub End Module That's how it's done.

    Read the article

  • Weird call stack when application has frozen

    - by Harriv
    I apparently have an dead lock problem in one of my applications and started investigating EurekaLog stack traces. Here's one recent: Call Stack Information: -------------------------------------------------------------------------------------------------------------------------------------- |Address |Module |Unit |Class |Procedure/Method |Line | -------------------------------------------------------------------------------------------------------------------------------------- |*Exception Thread: ID=14208; Priority=0; Class=; [Main] | |------------------------------------------------------------------------------------------------------------------------------------| |7C82860C|ntdll.dll | | |KiFastSystemCall | | |7C827D27|ntdll.dll | | |ZwWaitForSingleObject | | |77E61C96|kernel32.dll | | |WaitForSingleObjectEx | | |77E61C88|kernel32.dll | | |WaitForSingleObject | | |77E61C7B|kernel32.dll | | |WaitForSingleObject | | |004151C4|MyApp.exe |sysutils.pas |TMultiReadExclusiveWriteSynchronizer|WaitForWriteSignal |16740[1] | |004151BC|MyApp.exe |sysutils.pas |TMultiReadExclusiveWriteSynchronizer|WaitForWriteSignal |16740[1] | |0041522C|MyApp.exe |sysutils.pas |TMultiReadExclusiveWriteSynchronizer|BeginWrite |16818[57] | |004323FB|MyApp.exe |Classes.pas |TDataModule |Create |11357[1] | |004323C0|MyApp.exe |Classes.pas |TDataModule |Create |11356[0] | |007D744D|MyApp.exe |uRORemoteDataModule.pas |TRORemoteDataModule |Create |163[1] | |007D7434|MyApp.exe |uRORemoteDataModule.pas |TRORemoteDataModule |Create |162[0] | |007DBFAB|MyApp.exe |Sentrol_Impl.pas | |Create_Sentrol |85[1] | |00646952|MyApp.exe |uROServer.pas |TROInvoker |CustomHandleMessage |726[11] | |00407BFA|MyApp.exe |system.pas |TInterfacedObject |_AddRef |17972[1] | |00404934|MyApp.exe |system.pas |TObject |GetInterface |9003[8] | |00407B1C|MyApp.exe |system.pas | |_IntfClear |17817[1] | |00404966|MyApp.exe |system.pas |TObject |GetInterface |9009[14] | |004048E8|MyApp.exe |system.pas |TObject |GetInterface |8995[0] | |00407BD7|MyApp.exe |system.pas |TInterfacedObject |QueryInterface |17964[1] | |77E61680|kernel32.dll | | |InterlockedDecrement | | |00407C10|MyApp.exe |system.pas |TInterfacedObject |_Release |17977[1] | |00407B2C|MyApp.exe |system.pas | |_IntfClear |17824[8] | |004067DF|MyApp.exe |system.pas | |_FinalizeArray |15233[100]| |00407B1C|MyApp.exe |system.pas | |_IntfClear |17817[1] | |00646577|MyApp.exe |uROServer.pas |TROClassFactoryList |FindClassFactoryByInterfaceName|619[17] | |77E6166C|kernel32.dll | | |InterlockedIncrement | | |00407BFA|MyApp.exe |system.pas |TInterfacedObject |_AddRef |17972[1] | |00646B72|MyApp.exe |uROServer.pas |TROInvoker |HandleMessage |758[1] | |006460C5|MyApp.exe |uROServer.pas | |MainProcessMessage |512[98] | |00645BAC|MyApp.exe |uROServer.pas | |MainProcessMessage |414[0] | |00647184|MyApp.exe |uROServer.pas |TROMessageDispatcher |ProcessMessage |929[2] | |00647130|MyApp.exe |uROServer.pas |TROMessageDispatcher |ProcessMessage |927[0] | |00647BCF|MyApp.exe |uROServer.pas |TROServer |IntDispatchMessage |1328[27] | |00647ABC|MyApp.exe |uROServer.pas |TROServer |IntDispatchMessage |1301[0] | |0064782F|MyApp.exe |uROServer.pas |TROServer |DispatchMessage |1170[11] | |006477B4|MyApp.exe |uROServer.pas |TROServer |DispatchMessage |1159[0] | |006477A9|MyApp.exe |uROServer.pas |TROServer |DispatchMessage |1152[1] | |0064779C|MyApp.exe |uROServer.pas |TROServer |DispatchMessage |1151[0] | |00659CB6|MyApp.exe |uROLocalServer.pas |TROLocalServer |SendRequest |57[1] | |00659CA4|MyApp.exe |uROLocalServer.pas |TROLocalServer |SendRequest |56[0] | |0065A009|MyApp.exe |uROLocalChannel.pas |TROLocalChannel |IntDispatch |99[10] | |005EE540|MyApp.exe |uROClient.pas |TROTransportChannel |Dispatch |1884[36] | |005EE3FC|MyApp.exe |uROClient.pas |TROTransportChannel |Dispatch |1848[0] | |005EEC8F|MyApp.exe |uROClient.pas |TROTransportChannel |Dispatch |2134[27] | |00616EC8|MyApp.exe |PCCS_Intf.pas |TSentrol_Proxy |GetNewValues |6585[7] | |007CBDB9|MyApp.exe |ETAROConnectionForm.pas |TROConnectionForm |SyncSentrolUpdateTimerTimer |855[16] | |7C82ABE5|ntdll.dll | | |RtlTimeToTimeFields | | |004D5D9C|MyApp.exe |Controls.pas |TControl |WndProc |5063[0] | |004DA05B|MyApp.exe |Controls.pas |TWinControl |WndProc |7304[111] | |7C81A3AB|ntdll.dll | | |RtlLeaveCriticalSection | | |0042659C|MyApp.exe |Classes.pas |TThreadList |UnlockList |3359[1] | |00426598|MyApp.exe |Classes.pas |TThreadList |UnlockList |3359[1] | |004935BC|MyApp.exe |Graphics.pas | |FreeMemoryContexts |5060[12] | |00493524|MyApp.exe |Graphics.pas | |FreeMemoryContexts |5048[0] | |004D9799|MyApp.exe |Controls.pas |TWinControl |MainWndProc |7076[6] | |004329F4|MyApp.exe |Classes.pas | |StdWndProc |11583[8] | |7739C09A|USER32.dll | | |CallNextHookEx | | |004B1343|MyApp.exe |ExtCtrls.pas |TTimer |Timer |2281[1] | |00404A30|MyApp.exe |system.pas | |_CallDynaInst |9159[1] | |004B1227|MyApp.exe |ExtCtrls.pas |TTimer |WndProc |2239[4] | |004329F4|MyApp.exe |Classes.pas | |StdWndProc |11583[8] | |7739C42C|USER32.dll | | |GetParent | | |7739C45C|USER32.dll | | |GetParent | | |773A16E0|USER32.dll | | |DispatchMessageA | | |773A16D6|USER32.dll | | |DispatchMessageA | | |004CC234|MyApp.exe |Forms.pas |TApplication |ProcessMessage |8105[23] | |004CC138|MyApp.exe |Forms.pas |TApplication |ProcessMessage |8082[0] | |004CC26E|MyApp.exe |Forms.pas |TApplication |HandleMessage |8124[1] | |004CC264|MyApp.exe |Forms.pas |TApplication |HandleMessage |8123[0] | |004CC563|MyApp.exe |Forms.pas |TApplication |Run |8223[20] | |004CC4B0|MyApp.exe |Forms.pas |TApplication |Run |8203[0] | |007F18B3|MyApp.exe |MyApp.dpr | | |215[65] | The stack trace seems to be ok until first TTimer call, after that it contains some garbage(?), however the end contains the the lock which seems be holding the main thread. Can I trust this stack trace? If not, what can cause this and how I can avoid it? Any ideas about the dead lock based on this stack trace? I don't quite understand how creating a datamodule can dead lock.. I'm using Delphi 2007.

    Read the article

  • How to launch activity from android home screen widget

    - by Brian515
    Hi all, I am desperately trying to get my head wrapped around how to implement home screen widgets. Right now, I (finally) was able to get a button on my widget respond to a button press setting up an intent filter in the manifest. However, I cannot for the life of me figure out how to launch an activity when the button is pressed. Basically, here's the code i have: @Override public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); if(intent.getAction().equals("com.bic.search.searchWidget.CLICK")) { Toast.makeText(context, "It works!!", Toast.LENGTH_SHORT).show(); } } What I really want to do, though, is start a new activity, not display a toast message. I know it has something to do with pending intents, but I can't figure out how to get that to work. Any help and sample code would be appreciated. Thanks a ton to whoever answers this!

    Read the article

  • Creating my own Stack

    - by Malaken
    I am creating my own stack for my data structures class. For our assignment we are using the assignment to convert a real-time infix equation into a postfix equation. I thought my program: took input determines if it was digit or number(operand) prints it out determines if input is operator (+,-,/,*) adds to stack or prints out, depending on stack precedence Instead it prints out the operands as expect, but I get this error when I enter an operator .../dorun.sh line 33: 4136 Segmentation fault sh "$" [code] #include using namespace std; class DishWell{ public: char ReturnEnd(){ return Well.back(); } void Push(char x){ Well.push_back(x); } void Pop(){ Well.pop_back(); } bool IsEmpty(){ return Well.empty(); } private: vector<char> Well; }; #include <iostream> bool Precidence(char Input, char Stack){ int InputPrecidence,StackPrecidence; switch (Input){ case '*': InputPrecidence = 4; break; case '/': InputPrecidence = 4; break; case '+': InputPrecidence = 3; break; case '-': InputPrecidence = 3; break; case '(': InputPrecidence = 2; break; default: InputPrecidence = 0; } switch (Stack){ case '*': StackPrecidence = 4; break; case '/': StackPrecidence = 4; break; case '+': StackPrecidence = 3; break; case '-': StackPrecidence = 3; break; case '(': StackPrecidence = 2; break; default: StackPrecidence = 0; } if(InputPrecidence>StackPrecidence) return true; else return false; } int main(int argc, char** argv) { DishWell DishTray; char Input; bool InputFlag; InputFlag = true; while(InputFlag){ cin>>Input; if((((Input>='a'&&Input<='z')||(Input>='A'&&Input<='Z'))|| (Input>='0'&&Input<='9')))//If Digit or Number cout<<Input; if((Input=='*'||Input=='/'||Input=='+'||Input=='-')){//if operand if(Precidence(Input,DishTray.ReturnEnd())) DishTray.Push(Input); else if(!Precidence(Input,DishTray.ReturnEnd())) cout<<Input; } else if(!((((Input>='a'&&Input<='z')||(Input>='A'&&Input<='Z'))|| (Input>='0'&&Input<='9')))||((Input=='*'||Input=='/'||Input=='+'||Input=='-')))//if not digit/numer or operand InputFlag = false; } while(!DishTray.IsEmpty()){ cout<<DishTray.ReturnEnd(); DishTray.Pop(); } return 0; [code] My code is very length, I know, but I appreciate help. Especially any times for efficency or future coding. Thanks again P.S. Dr. Zemoudeh, this is your student Macaire

    Read the article

  • How to refresh an activity?

    - by poeschlorn
    Hi Guys, after implementing some Android Apps, including several Map activities, I try to refresh the activity when the GPS listener's onLocationChanged() mehtod is called. I have no Idea how to tell the map activity to refresh on its own and display the new coords... the coords to store will have to be in global values, so that the location listener will have access to it. In my sample GPS-class (see code below) I just changed the text of a text view....but how to do that in map view? private class MyLocationListener implements LocationListener { @Override public void onLocationChanged(Location loc) { final TextView tv = (TextView) findViewById(R.id.myTextView); if (loc != null) { tv.setText("Location changed : Lat: " + loc.getLatitude() + " Lng: " + loc.getLongitude()); } } I think the solution of this Problem won't be very difficult, but I just need the beginning ;-) This whole app shall work like a really simple navigation system. It would be great if someone could help me a little bit further :) nice greetings, Poeschlorn

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >