This is what I have for my code:
package com.technologx;
import android.app.Activity; import android.content.Intent; import android.
net.Uri; import android.os.Bundle; import android.view.KeyEvent; import
android.view.Window; import android.webkit.WebChromeClient; import android.
webkit.WebSettings; import android.webkit.WebView; import android.webkit.
WebViewClient; import android.widget.Toast;
public class Home extends Activity { WebView myWebView;
@Override protected void onCreate(Bundle savedInstanceState) { super.
onCreate(savedInstanceState); setContentView(R.layout.home_activity); //
Let's display the progress in the activity title bar, like the
// browser app does.
getWindow().requestFeature(Window.FEATURE_PROGRESS);
myWebView.getSettings().setJavaScriptEnabled(true);
final Activity activity = this;
myWebView.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress) {
// Activities and WebViews measure progress with different scales.
// The progress meter will automatically disappear when we reach 100%
activity.setProgress(progress * 1000);
}
});
myWebView.setWebViewClient(new WebViewClient() {
public void onReceivedError(WebView view, int errorCode, String description
, String failingUrl) {
Toast.makeText(activity, "Oh no! " + description, Toast.LENGTH_SHORT).show
();
}
});
myWebView = (WebView) findViewById(R.id.home);
myWebView.loadUrl("https://technologx.com");
WebSettings webSettings = myWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
myWebView.setWebViewClient(new MyWebViewClient());
}
private class MyWebViewClient extends WebViewClient { @Override public
boolean shouldOverrideUrlLoading(WebView view, String url) { if (Uri.parse(
url).getHost().equals("technologx.com")) { return false; } Intent intent =
new Intent(Intent.ACTION_VIEW, Uri.parse(url)); startActivity(intent);
return true; } }
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if ((keyCode
== KeyEvent.KEYCODE_BACK) && myWebView.canGoBack()) { myWebView.goBack(); //
Go to previous page return true; } // Use this as else part return
super.onKeyDown(keyCode, event); }
}
But I run into these errors:
I
nformation:Gradle tasks [:app:assembleDebug] Observed package id
'add-ons;addon-google_apis-google-16' in inconsistent location
'/Users/Technologx/Library/Android/sdk/add-ons/addon-google_apis-google-16-1'
(Expected
'/Users/Technologx/Library/Android/sdk/add-ons/addon-google_apis-google-16')
Observed package id 'add-ons;addon-google_apis-google-17' in inconsistent
location
'/Users/Technologx/Library/Android/sdk/add-ons/addon-google_apis-google-17-1'
(Expected
'/Users/Technologx/Library/Android/sdk/add-ons/addon-google_apis-google-17')
Observed package id 'add-ons;addon-google_apis-google-18' in inconsistent
location
'/Users/Technologx/Library/Android/sdk/add-ons/addon-google_apis-google-18-1'
(Expected
'/Users/Technologx/Library/Android/sdk/add-ons/addon-google_apis-google-18')
Observed package id 'add-ons;addon-google_apis-google-19' in inconsistent
location
'/Users/Technologx/Library/Android/sdk/add-ons/addon-google_apis-google-19-1'
(Expected
'/Users/Technologx/Library/Android/sdk/add-ons/addon-google_apis-google-19')
Observed package id 'add-ons;addon-google_apis-google-21' in inconsistent
location
'/Users/Technologx/Library/Android/sdk/add-ons/addon-google_apis-google-21-1'
(Expected
'/Users/Technologx/Library/Android/sdk/add-ons/addon-google_apis-google-21')
Observed package id 'add-ons;addon-google_apis-google-22' in inconsistent
location
'/Users/Technologx/Library/Android/sdk/add-ons/addon-google_apis-google-22-1'
(Expected
'/Users/Technologx/Library/Android/sdk/add-ons/addon-google_apis-google-22')
:app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2421Library
UP-TO-DATE :app:prepareComAndroidSupportAppcompatV72421Library UP-TO-DATE :
app:prepareComAndroidSupportSupportCompat2421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportCoreUi2421Library
UP-TO-DATE :app:prepareComAndroidSupportSupportCoreUtils2421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportFragment2421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportMediaCompat2421Library
UP-TO-DATE :app:prepareComAndroidSupportSupportV42421Library UP-TO-DATE :app
:prepareComAndroidSupportSupportVectorDrawable2421Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing810Library
UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesBasement810Library UP-
TO-DATE :app:prepareDebugDependencies :app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript
UP-TO-DATE :app:generateDebugBuildConfig UP-TO-DATE :app:mergeDebugShaders
UP-TO-DATE :app:compileDebugShaders UP-TO-DATE :app:generateDebugAssets UP-
TO-DATE :app:mergeDebugAssets UP-TO-DATE :app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE :app:mergeDebugResources UP-TO-DATE :
app:processDebugManifest UP-TO-DATE :app:processDebugResources UP-TO-DATE :
app:generateDebugSources UP-TO-DATE
:app:incrementalDebugJavaCompilationSafeguard
UP-TO-DATE :app:compileDebugJavaWithJavac None of the classes needs to be
compiled! Analysis took 0.031 secs. :app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources
:app:prePackageMarkerForDebug :app:transformClassesWithDexForDebug To run
dex in process, the Gradle daemon needs a larger heap. It currently has
approximately 910 MB. For faster builds, increase the maximum heap size for
the Gradle daemon to more than 2048 MB. To do this set org.gradle.jvmargs=-
Xmx2048M in the project gradle.properties. For more information see https:
//docs.gradle.org/current/userguide/build_environment.html Error:Error
converting bytecode to dex: Cause: com.android.dex.DexException: Multiple
dex files define
Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
:app:transformClassesWithDexForDebug FAILED Error:Execution failed for task
':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.
process.ProcessException: java.util.concurrent.ExecutionException: com.
android.ide.common.process.ProcessException: org.gradle.process.internal.
ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0
_102.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2
Information:BUILD FAILED Information:Total time: 59.301 secs Information:2
errors Information:0 warnings Information:See complete output in console
I am new to creating android apps, I'm also wanting this app to set a
cookie for the remember me option on my site. I'd also like to know if the
app can restore the state it was in before the user closed the app? If so
how can I add this to my code?
--
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/android-developers/787da49e-674c-4920-b726-c578124f7fb8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.