Good morning - I hope everyone has had an enjoyable weekend.
I am having some issues following the tutorial at https://developer.chrome.com/multidevice/webview/gettingstarted
Everything is going well until I reach the step regarding an edit of the MainActivity class. This is Step 3 in the section Add the WebView: https://developer.chrome.com/multidevice/webview/gettingstarted#add_the_webview
Here is the content of my AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.nathan.myapplication" >
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MyActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
And here is my MyActivity.java:
package com.example.nathan.myapplication;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.webkit.WebView;
public class MyActivity extends Activity {
private WebView mWebView; // Added by ND Guthrie 8.15.2014:2229
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my);
mWebView = (WebView)findViewById(R.id.activity_my_webview); // Added by ND Guthrie 8.15.2014:2231
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.my, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
I have tried suggestions based on these links here on stackoverflow:
Error with R class import in android
Android Studio don't generate R.java for my import project
For the error with R class import, I have attempted adding the line
import com.TestApp.HelloWebView.R;
But with no success, as TestApp is not recognized. This stands to reason, since I have not named anything 'TestApp' in my app here, but I do not understand how to fix it.
I also tried deleting the generated folder and cleaning and rebuilding the project. However, I obtain the same results.
I know this is probably a silly little thing, but I have been searching google and stackoverflow for days now, and it seems like there is just something I am not seeing.
Any ideas? Please advise.
Thank you very much for your time!
Best, Nathan