w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to completely clear/set text of WinRT's RichEditBox?
You can call SetText(Windows.UI.Text.TextSetOptions.None, null). From the documentation of SetText: If the string is NULL, the text in the document is deleted.

Categories : C#

What is the alternative to kill/clear text till the end of buffer?
You can use that ELISP function in your .emacs (defun bruce-kill-to-end () (interactive) (let ((beg (point)) (end (point-max))) (delete-region beg end))) Then bind it to whatever you like: (global-set-key [f9] 'bruce-kill-to-end) EDIT If you have a selection, it does not start from current cursor but from begin of selection EDIT 2 : removed part about selection

Categories : Emacs

How to kill/finish and activity from another activity?
My suggestion is to call finish() on the Pitanja_cigle Activity at the same time as when the OK button is pressed. OK.setOnClickListener(new OnClickListener() { public void onClick(View v) { Pitanja_cigle.this.finish(); finish(); } });

Categories : Java

Flag Activity Clear Top destroys target activity and than creating it
Use FLAG_ACTIVITY_REORDER_TO_FRONT and then use an intent to tell B to finish. Activity B: private BroadcastReceiver finishReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { finish(); } }; public void onCreate() { LocalBroadcastManager.getInstance(this) .registerReceiver(finishReceiver , new IntentFilter("B-finish")); } public void onDestroy() { LocalBroadcastManager.getInstance(this).unregisterReceiver( finishReceiver ); } Activity C: LocalBroadcastManager.getInstance(this).sendBroadcast( new Intent("B-finish")); Intent intent_to_a=new Intent(C.this,A.class); intent_to_home.setFlags(Intent.FLAG_ACTI

Categories : Android

android how to kill an activity in another one?
startActivity(intent);//start the next activity finish(); //finish the current activity Found a descriptive discussion here

Categories : Java

Locking down an Activity completely
This sounds like you need the app to be fullscreen. You achieve that like this in your Activity.onCreate(): getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); Be aware that an incoming call will go on top of the current application. To be sure the device will not go to sleep: Simply disable that in the settings Use android:keepScreenOn="true" in your layout (by far the easiest option) Use a WakeLock Also, the user still can press the power button to lock the device. But disabling the power button doesn't seem like a good idea to me. About the notification bar (discussed in the comments): take a look at this thread: Disable Android Notification Bar in Full Screen (in SGIII)

Categories : Android

Closing completely an app not just an activity
You should not use System.exit(0). Use finish() instead .finish will pop the activity from the activity back stack and destroy it. Previous activity in the back stack takes focus. Check this link and comments by Dianne Hackborn https://groups.google.com/forum/#!topic/android-developers/Zhd1fRfHAAQ Check this link and comments by Romain Guy https://groups.google.com/forum/#!topic/android-developers/G_D3pKnGLt0 Quoting from comment by Streets of Boston https://groups.google.com/forum/#!topic/android-developers/Y96KnN_6RqM You should not call System.exit(). It could mess up Android's handling of the lifecycles of your activities and result in an awkward user-experience (e.g. when killing the process, the previous activity from which you laucnhed your activity may be gone as well. An

Categories : Java

How to kill CountDownTimer When I start an activity?
In ActivityA run this code before you start ActivityB myTimer.cancel(); myTimer = null; and reset your start time 20000. Now when this Activity is created again it should reset your CountDownTimer object.

Categories : Android

Will activity run onDestroy when system kill it?
From the developer.android.com : When your activity receives a call to the onStop() method, it's no longer visible and should release almost all resources that aren't needed while the user is not using it. Once your activity is stopped, the system might destroy the instance if it needs to recover system memory. In extreme cases, the system might simply kill your app process without calling the activity's final onDestroy() callback, so it's important you use onStop() to release resources that might leak memory. So, android usually will call onDestroy() of your activity before it is killed but it is not guaranteed. Link : http://developer.android.com/training/basics/activity-lifecycle/stopping.html

Categories : Android

When Activity loads completely with Monkeyrunner
This would not be exactly the same as your app but you'll get the idea. The solution is based on AndroidViewClient/culebra. I'm using the Progress dialog example from API Demos so it will be easily reproducible by anyone. When you press API Demos -> App/Alert Dialogs you obtain then you can run culebra to automatically generate a test script $ culebra -VC -t on -r -o myscript.py edit the script to remove the unneeded Views and loop while progress is being incremented # generated script lines removed for clarity while True: vc.dump(window='-1') no_id15 = vc.findViewWithTextOrRaise(re.compile('d+/100')) print no_id15.getText() the output would be Connecting to a device with serialno=.* with a timeout of 60 secs... Connected to device with serialno=.* Actual device s

Categories : Android

Can Android 'kill' an Activity without killing the application?
Does the Android system actually 'kill' (release) an activity instantly without calling these methods? Yes it does. Here's what the docs say in regards to onStop(): Note that this method may never be called, in low memory situations where the system does not have enough memory to keep your activity's process running after its onPause() method is called. and in regards to onDestroy(): There are situations where the system will simply kill the activity's hosting process without calling this method (or any others) in it, so it should not be used to do things that are intended to remain around after the process goes away. Do not count on this method being called as a place for saving data! For example, if an activity is editing data in a content provi

Categories : Android

Kill Android Activity having a main Thread
Try to change android:launchMode of MainMenu activity in your AndroidManifet.xml. Probably, "singleTop" is what you need.

Categories : Java

Get data from an activity in AppWidget after clear memory
To store data, u need service ruining in background. http://developer.android.com/reference/android/app/Service.html#startForeground(int, android.app.Notification) And to comunicate with serive use BroadcastReciver. http://developer.android.com/reference/android/content/BroadcastReceiver.html

Categories : Android

History Stack of activity clear in android
In your comments you suggested that you've tried using flags like: Intent i = new Intent(MainActivity.this,SecondActivity.Class); i.addFlags(android.flags.FLAG_CLEAR_TOP | FLAG_NEW_TASK | FLAG_CLEAR_TASK) But instead try using them like: Intent intent = new Intent(MainActivity.this,SecondActivity.Class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_CLEAR_TASK);

Categories : Android

How to clear values of all static variables at the end of an activity Android?
May these help you.. Using Static Variables is like a nightmare in any activity as it stores memory through out the activity.. I think you can try some other memory store to overcome your problem of passing value from one activity to another.. In my opinion u can store values in SharedPreference or either you can pass value through intent to other activity where ever it is required.. Hope these will help you.. EDIT: Intent in = new Intent(MainActivity.this,SecondActivity.class); You can use more than one putExtra() method to put several values and can fetch then in Second Activity in.putStringArrayListExtra(String name, ArrayList<String> value); StartActivity(in); In Second Activity: Intent in = getIntent(); ArrayList<String> Roleids = new ArrayList<String>;

Categories : Android

Android: can you use an AlertDialog to clear data so it isn't corrupted after starting an email activity?
Android devices can behave very different, one from another. You could have slowness in your mail activity, or you could have your device to suddenly decide to clean up memory and make every thing slow slow slow for a moment. If you are relying on timing in hoping that some other process or thread is completed before you delete something, you are playing with fire. I think a better approach would be to start your e-mail activity for result, like CapDroid did in this answer: Send Mail: int EMAIL = 101; Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType("text/html"); emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,new String[]{}); emailIntent.putExtra(android.content.Intent.EXTRA_BCC,new String[]{}); emailIntent.putExtra(android.content.In

Categories : Java

how to kill a passthru process upon the kill of a php script?
Function passthru() spawns a shell to run your command and then blocks until the passthru process returns. Those are independent processes with different Process IDs than the php interpreter running your script. You can kill the script but you won't kill the processes it started. However the spawned processes have the same Process Group ID (PGID) and you can use that to kill them or sent them any other signal. The PGID in our case would be the same as the Process ID (PID) of the php script. To see the PGIDs you can execute the command: ps axjf and you will get something like: PPID PID PGID SID TTY TPGID STAT UID TIME COMMAND 24077 12484 12484 24077 pts/9 12484 S+ 1000 0:00 | \_ php sleepScript.php 12484 12486 12484 24077 pts/9 12484 S+ 1000 0:00 |

Categories : PHP

kill -INT vs kill -TERM
The only difference in the response is up to the developer. If the developer wants the application to respond to SIGTERM differently than to SIGINT, then different handlers will be registered. If you want to stop a background process gracefully, you would typically send SIGTERM. If you are developing an application, you should respond to SIGTERM by exiting gracefully. SIGINT is often handled the same way, but not always. For example, it is often convenient to respond to SIGINT by reporting status or partial computation. This makes it easy for the user running the application on a terminal to get partial results, but slightly more difficult to terminate the program since it generally requires the user to open another shell and send a SIGTERM via kill. In other words, it depends on th

Categories : Unix

Pass data object to an Activity from another activity (Fragment -> its Activity-> new Activity)
I assume your ZEvent implements Parcelable... If it does, then put in in the intent using putExtra (instead of creating new Bundle and using putExtras), and extract the same way using getParcelableExtra. // Put final Intent intent = new Intent(context, <class>); intent.putExtra("MY_EVENT", obj); // <-- Should be parcelable // Get. ZEvent obj = intent.getParcelableExtra("MY_EVENT");

Categories : Java

calling async task from activity via button ... progressdialog apears after activity has switched to another activity
Don't show the Progressdialog within the Thread, in which you run the background task. I had the same issue and did the following: Prepare the Dialog Show the Dialog Start the background task EDIT: Try to call the ProgressDialog as below: runOnUiThread(new Runnable() { @Override public void run() { final ProgressDialog progressDialog=new ProgressDialog(cont); progressDialog.setMessage("Progress"); progressDialog.show(); } });

Categories : Android

Confusion between "#define clear()" and "std::wstring::clear()"
The reason is because the preprocessor basically does a search-and-replace on all macros that are defined. And it's done before the compiler proper gets the code, and it does not know anything about namespaces, classes or scope in general. So if you have e.g. #define clear() something and then use wstr.clear(); The preprocessor will replace the clear() so that the compiler sees wstr.something;

Categories : C++

How to clear the bottom of an image like clear left / right
Based on your image, you can realize the layout by using the the following HTML: <div class="contentpart"> <a href="#"> <img src="http://placehold.it/300x200"> </a> Donec adipiscing, lorem non euismod venenatis... </div> and applying the following CSS rules: .contentpart { border: 1px dotted gray; display: table; } .contentpart a { display: table-cell; vertical-align: top; padding-right: 20px; } You can see the demo at: http://jsfiddle.net/audetwebdesign/wknjA/ How This Works You can use CSS tables to get the text to stay in a single column without wrapping it in a block element. Apply display: table to the parent block and display: table-cell to the a tag. You can have some control over white space by

Categories : CSS

Launching a new Activity from a Context Menu and automating another Activity in the onCreate relaunches the same Activity
I found the solution to it, after trying over and over to understand why. All that needs to be done is to create a runnable in the Context menu, as it seems to need to be returned quickly otherwise it recreates the Activity. I could be wrong and please feel free to correct me on this one. Activity A - Context Menu @Override public boolean onContextItemSelected(MenuItem item) { AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); final ItemClass selItem = (ItemClass)this.getListView().getItemAtPosition(info.position); Intent intent; SyncData sync; switch (item.getItemId()) { case R.id.start_activity_b: runOnUiThread(new Runnable() { @Override publi

Categories : Android

Activity starting another activity. Guarantee that the first activity's onPause will be called before second's onResume
Yes. Activity A's onPause() will be called before passing to Activity B's onResume() if the navigation is not the first time. If navigating to Activity B is for the first time, then Activity B's onCreate() will be called after Activity A's onPause(). Take a look at Activity's Lifecycle for clear understanding.

Categories : Android

How Do I Kill A Thread In Racket? Kill-thread keeps using "proc" rather than thread
Right now, you're creating the new thread and deleting it immediately with (kill-thread (start)), while the old one is untouched. If you only need to keep track of the single main game thread (aka thats the only thing passing through start and stop) you can use set! and a global variable to keep track of the thread: #lang racket (define game (lambda () (let loop () (sleep 2) (printf "game running ") (loop)))) (define GAME-THREAD (void)) (define start (lambda () (set! GAME-THREAD (thread game)))) (define stop (lambda () (with-handlers ([exn:fail? (lambda (exn) (displayln (string-append "Failed to kill main game thread. " (exn-message exn)))

Categories : Multithreading

start Fragment Activity from activity? "java.lang.IllegalStateException: Could not execute method of the activity" onClick (View view)?
You are missing this class: com.qc.app.ffma.MapScreen Maybe something went wrong with your dependencies (libs/jars) - check this solution (java.lang.NoClassDefFoundError with external jars in Android project)

Categories : Android

Java clear console error: java.io.IOException: Cannot run program "clear"
There's pretty much nothing in the console related API to do a clear screen. But, I think you can achieve the same effect through println()s. A lot of putty clients clear the page like that and then scroll up. private static final int PAGE_SIZE = 25; public static void main(String[] args) { // ... clearScreen(); } private static void clearScreen() { for (int i = 0; i < PAGE_SIZE; i++) { System.out.println(); } }

Categories : Java

How to pass value from parent activity to child activity and on child activity exit, refresh the parent activity
In WIndow1: Start your child activity as Intent MyRotationsAddPicture1 = new Intent(getBaseContext(), MyRotationsAddPicture.class); MyRotationsAddPicture1.putExtra("Title", "1"); MyRotationsAddPicture1.putExtra("Content", "2"); startActivityForResult(MyRotationsAddPicture1, 0); Override: protected void onActivityResult(int requestCode, int resultCode, Intent data) { } In window 2: // Get - from Window2 Log.d(TAG, getIntent().getExtras().getString("Title")); // Workout and exit this Window2 > to go back Window1 and show the latest update on window1 setResult(0); this.finish(); protected void onActivityResult (int requestCode, int resultCode, Intent data) Added in API level 1 Called when an activity you launched exits, gi

Categories : Java

Adding and Removing Dynamic Buttons From one activity to another activity in android on click of button from previous activity button click
In the first activity's onClick send the data using Intent: intent = new Intent(this, PCode.class); intent.putExtra("EXTRA_BTN_NAME", editText.getText()); intent.putExtra("EXTRA_WHERE", where); startActivity(intent); In the new activity you should get the data with @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activty2); Intent intent = getIntent(); String btnName = intent.getStringExtra("EXTRA_BTN_NAME"); where= intent.getStringExtra("EXTRA_WHERE"); LinearLayout l1 = (LinearLayout) findViewById(R.id.layout); Intent intent1 = new Intent(context1,PCode.class); Button b = new Button(this); b.SetText(btnName); //TODO - use the "where" parameter l1.addView

Categories : Android

What is more efficient: vector.clear() or if(vector.empty()) clear();?
An empty vector is a valid vector. So the operation a.clear(); is valid on an empty vector. Test for emptiness before clear is unnecessary and time consuming, so the first one is more efficient.

Categories : C++

android eclipse: switch activity briefly shows previous activity screen
This depends on what phone you're using since different phones use different anamations. Try to call finish(); on every activity but your main one for example.. Or finish them all when the user switches activities

Categories : Java

Android Main activity listening and receiving values/signals from another activity periodically
The code that is running in MainActivity needs to be moved to a service or something that has a lifecycle independant of which is currently displayed on the screen. This is because Activities can be killed off by the OS while they are not in focus. I would suggest an IntentService that when it runs it does the periodic task you need then schedules itself to run again via a pending intent. A good example of this is here: http://www.vogella.com/articles/AndroidServices/article.html

Categories : Android

Intent not carrying data to next activity, and button to go back to previous activity not working
As tgrll mentioned in a comment, you have to add the method tryAgainButton as onClickListener in your layout otherwise nothing happens if you don't add the onclick method programmatically: android:onClick="tryAgainButton" <Button android:id="@+id/tryAgainButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/scoreInfo" android:layout_below="@+id/scoreFinalText" android:layout_marginTop="92dp" android:text="Try Again?" android:onClick="tryAgainButton" />

Categories : Android

Error to pass from activity with Navigation Drawer to activity with relative layout Android
You should change convertView = inflater.inflate(R.layout.myprofile_user_item_layout, parent, false); to convertView = inflater.inflate(R.layout.myprofile_user_item_layout,null); Since you are not depending on the parent layout for parameters you should not specify it in the inflating of the layout that you are.

Categories : Android

Passing a long type variable from one activity and receiving it in another activity and displaying it in a TextView
1. int id =(int) intent.getExtras().getLong("data_id"); 2. As your id of int type so you need type casting in txt_id.setText(id); so your code should be: either txt_id.setText(""+id); or txt_id.setText(Integer.valueOf(id).toString());

Categories : Java

Add Click Event to Expandable List View Child While Extending Activity instead of Activity?
You forgot to add onChildClick to view. Try this : private void initPage() { mExpandableListView = (ExpandableListView) findViewById(R.id.expandableListView); ExpandableListAdapter adapter = new ExpandableListAdapter(this, mExpandableListView, mGroupCollection); mExpandableListView.setAdapter(adapter); mExpandableListView.setOnChildClickListener(this); } Best wishes.

Categories : Android

Why does Apps Main Activity not take new values of variables after they are changed when the activity starts?
Remove: MainActivity longlat = new MainActivity(); You don't need to create an object of an Activity inside another. You take the user input value from one activity and start another activity using Intent. Intent intent = new Intent(CurrentActivity.this, NewActivity.class); startActivity(intent); If you want to pass data between them, you can pass extra parameters to the new Activity using putExtra function. intent.putExtra("param1", paramValue); See How do I pass data between activities in Android? for more.

Categories : Android

Result activity closes main activity when pressing back button
You forgot the break statement before case GlobalVar.REQUEST_ENABLE_BT: The execution continues in this case, and reaches the finish() statement because the default RESULT_CODE for back press is Activity.RESULT_CANCEL.

Categories : Android

Managing the Activity Lifecycle demo activity return to original A if Start A
It's because the launchMode for Activity A is "singleTask". This gets declared in the AndroidManifest.xml file under Activity A's <activity> tag. From this file, you can modify many aspects of the the behavior of your Activities, Services, etc. From the documentation: In contrast, "singleTask" and "singleInstance" activities can only begin a task. They are always at the root of the activity stack. Moreover, the device can hold only one instance of the activity at a time — only one such task.

Categories : Android

How to start splash activity(very first activity) from left to right animation effect in android
Replace "view" with your outermost Layout name. Write this code in your oncreate method of the activity that you want the animation to occur. animationSlideInLeft = AnimationUtils.loadAnimation(this, android.R.anim.slide_in_left); animationSlideInLeft.setDuration(1500); animationSlideInLeft.setAnimationListener(new AnimationListener(){ @Override public void onAnimationEnd(Animation animation) { // if you need to do something } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationStart(Animation animation) { }}); view.startAnimation(animationSlideInLeft);

Categories : Android



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.