3

So I'm working on an Android app that uses a webview and often when debugging I only change the javascript that is loaded from the web. When I hit run in Eclipse it won't recompile since I haven't changed any local files.

Is there a way to force this behavior so I don't have to make a small change in an Eclipse file -> save -> rerun every time. I don't want to restart the app in emulator since that would also be tedious.

The webview loads some JS from my server. I notice a bug in the JS. I fix the bug. Now, when I go back into Eclipse I would like it to restart the app and not give me the message ActivityManager: Warning: Activity not started, its current task has been brought to the front as it does now. It does not need to recompile, just restart but I guess I thought forcing it to recompile would be an easier setting to find.

Kirk
  • 16,182
  • 20
  • 80
  • 112
JLndl
  • 157
  • 1
  • 1
  • 7
  • Why should the application be recompiled if _downloaded data_ changes? There must be something I'm not understanding about this question because this sounds more like you are missing a refresh button in your application. – HonkyTonk Aug 14 '13 at 21:54
  • @HonkyTonk Sorry, to clarify: My app has a webview. The webview loads some JS from my server. I notice a bug in the JS. I fix the bug. Now, when I go back into Eclipse I would like it to restart the app and not give me the message ActivityManager: Warning: Activity not started, its current task has been brought to the front as it does now. It does not need to recompile, just restart but I guess I thought forcing it to recompile would be an easier setting to find. – JLndl Aug 14 '13 at 21:57
  • This, still, sounds like you need a refresh button (or menu option). You can always add it while developing and remove it when you're ready to release the application. – HonkyTonk Aug 14 '13 at 22:05
  • Hmm yeah, not quite what I was hoping to get but that would solve some of my problems. Would mess with UI though. Thanks. – JLndl Aug 14 '13 at 22:11
  • Overload a hard button so you wouldn't need to touch the UI... Maybe menu button long press or something... – Tonithy Aug 15 '13 at 04:38

2 Answers2

0

Found another post with the same question after changing my google parameters, unless something has changed there doesn't seem to be a quick fix.

How to force Eclipse to restart an app that has not changed

Community
  • 1
  • 1
JLndl
  • 157
  • 1
  • 1
  • 7
0

It sounds like you just need to reload the web page within the browser. It's hard to tell what options you have in your WebView, but you can add a button to do the refresh to reload your web page without restarting the app.

See Is there a better way to refresh WebView?

From there, add a Button

<Button
  android:id="@+id/new_button"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:text="Refresh"
 />

Then after referencing the Button, assign it an OnClickListener to reload the page.

newButton.setOnClickListener(new View.OnClickListener() {
   public void onClick(View v) {
    MyActivity.this.mWebView.loadUrl("http://www.websitehere.php");
   }});

This should reload your page after you've updated it.

Also instead of using the emulator, just install it on your phone and use the refresh button to view it in your app. Should be significantly faster than an emulator.

Community
  • 1
  • 1
Kirk
  • 16,182
  • 20
  • 80
  • 112