• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps How to make a slide in Android app menu for a webview app?

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:

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.
 
I assume that you want to do something like a Navigation Drawer. There is a pretty good tutorial with example app written by Google(here). For a complete beginner it may be a bit difficult to understand everything at first, just google it or ask again.

If you want to load url's you can do it like this

Java:
webView.loadUrl("http://www.mySite.com");

You could create simple buttons with OnClick-Events or something like this.
If you want to refresh you can just load the URL again.

Note that the WebView isn't supposed to be used for navigation purposes and is far from being a full-featured browser. I haven't quite got what you want to do with your app.
 
I just want a app for my forum but I want to create it so I can learn how to make a android app. I mean if someone was willing to help me make one that would be cool.
 
Back
Top Bottom