Technologx
Newbie
I was wondering how I can add a slide in menu to my webview android app? I don't know how to create a android app so I've been looking at guides online.
Here's my code:
I just want a sign in/sign out, register, pm's, preferences, admin menu buttons. They will all be website links since it's a forum. I hope this isn't a lot to ask for. Also yes I know I'm a complete noob.
Also I'd like to make it to where links will open in the app when tapped instead of the browser on the device.
Here's my code:
Code:
package pw.technologx;
import android.support.v7.app.ActionBarActivity;import android.os.Bundle;import android.view.KeyEvent;import android.view.Menu;import android.view.MenuItem;import android.webkit.WebSettings;import android.webkit.WebView;import android.webkit.WebViewClient;
publicclassHomeextendsActionBarActivity{
privateWebView webView;
@Overrideprotectedvoid onCreate(Bundle savedInstanceState){super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
WebView webView =(WebView) findViewById(R.id.webView);
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setDomStorageEnabled(true);
webView.loadUrl("http://technologx.pw");}
@Overridepublicboolean onKeyDown(int keyCode,KeyEvent event){if((keyCode ==KeyEvent.KEYCODE_BACK)&&this.webView.canGoBack()){this.webView.goBack();returntrue;}
returnsuper.onKeyDown(keyCode, event);}
privateclassMyWebViewClientextendsWebViewClient{@Overridepublicboolean shouldOverrideUrlLoading(WebView webView,String url){returnfalse;}}
@Overridepublicboolean onCreateOptionsMenu(Menu menu){// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_home, menu);returntrue;}
@Overridepublicboolean 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();
//noinspection SimplifiableIfStatementif(id == R.id.action_settings){returntrue;}
returnsuper.onOptionsItemSelected(item);}}
I just want a sign in/sign out, register, pm's, preferences, admin menu buttons. They will all be website links since it's a forum. I hope this isn't a lot to ask for. Also yes I know I'm a complete noob.
Also I'd like to make it to where links will open in the app when tapped instead of the browser on the device.