Google+

Friday, 7 March 2014

Android WebView Example | How to create WebView?

       Hello everybody, its been a while since I have blogged about something. Today I am not going to write about any Android app or Android tech, But today I will teach you about how to make an android app to show your own website. I know there exist many sites like appgeyser  which will let you create such types of apps, but if you want to learn to make android app than you need to start learning somewhere. So why not start with making of webView? P.S In simple language webView is used to show webpage. You can read about webView on android developer tools. And yes I would like to make one thing clear, I am not some big Android developer, Here I will be sharing in next few posts what I have learnt in last few months. Anyway will try to help you in all ways possible.

So lets stop talking and get to work.

To start Android App development you'll need Android Developer Tools. You can get here. All tools needed are already there on that site. You just have to download it. And how to set an Android Development Environment can be found here. Actually I was going to write about it in detail but then it was written in such an easy and simple way on Android Developer site that I thought that I won't be able to simplify it more and you can very well read it there [Links are very well provided].
  • So after you are done with setting up an environment, Start eclipse.
  • When you start eclipse, it will ask to load a workspace, If it would be your first time you can use default workspace or create your own.
  • After you have defined workspace, eclipse will load. Than go to file>new>project>Than select Android and than Android Application Project.
Screen will look like this..


  • Than new Screen will imerge which will ask you for Activity name, Application name, Package name and so on. (remember to write package name properly as, when you submit your app to android playstore, package name will be included in your app's URL)

  • Click Next on this screen without making any changes.

  • You can click Next in this screen too,  You can define your app icon here. But I skip it always as you can always add that later too.

  • Click Next in this screen too. It lets you create different types of activities like you want particular activity to start in full screen mode or master detail mode. But we will take blank activity for this app.

  • Next screen will ask you to write activity name and layout name. Write that name as you want or keep it unchanged. Click finish here and it will take you to our destination where we will start coding.


  • Than go to WebView > res > layout > layout file ( In my case it is main.xml) and paste following code.
<framelayout 
android:id="@+id/container" 
android:layout_height="match_parent" 
android:layout_width="match_parent" 
tools:context=".MainActivity" 
tools:ignore="MergeRootFrame" 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools">
         
<webview 
android:id="@+id/activity_main_webview" 
android:layout_height="match_parent" 
android:layout_width="match_parent"/>
</framelayout>
Your graphical layout will look something like this


  • Than we will need to write code in source folder. For that go to webView > src > in.droidgyaan (That's my activity name) 
  • Than paste following code

package in.droidgyaan;

import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.app.Activity;


public class MainActivity extends Activity {
    
    private WebView mWebView;
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main); //Sets layout to main layout defined in res>layout>main
        mWebView = (WebView) findViewById(R.id.activity_main_webview); //finds webview by id we mentioned in main.xml
        //Enables JavaScript
        WebSettings webSettings = mWebView.getSettings();
        webSettings.setJavaScriptEnabled(true); //Sets javascript to true
        mWebView.setWebViewClient(new WebViewClient()); 
        mWebView.loadUrl("http://www.droidgyaan.in/?m=1"); //It loads website we mention here.
       
    }
}

  • Now you are ready with your first android app. But remember if you have made any changes to activity name after you made your project or midway somewhere, you will need to change activity name in manifest file too, otherwise your app won't run, it will give error. You'll need to add internet permission to manifest file to allow application to use internet. You can give access to internet by using following code in your manifest file.
<uses-permission android:name="android.permission.INTERNET"/>


  • Now after you are done with coding, you can make an .apk file to run it on your phone.by going to File > Export > Android > Export Android Application > Select project you want to export as apk file > Now select keystore > Now select keyalias > Now select destination folder to save your apk file. (Keystore is used to encrypt your app with particular key, you can use default keystore by going to C drive > Users > Select admin username > than go to .android > select debug.keystore. Password for it is android. This is debug key provided by Google. While releasing android app it is preferable to make your apk file by your own keystore. But remember to store your keystore as safely as possible because if you release an app on playstore with X keystore and than after sometime you want to release an update to your app than you have to use that same keystore as you used before otherwise it will be considered new app. So keep copy of that keystore at as many place you can. I would recommend save it on cloud. Make your own keyalias too along with keystore).

Now we are done with our first Android App Development tutorial. Hope it is helpful to you.

You can download source code for this project from my Github, Click here to download.


If you have any questions fire it up in comment section below. I will try to solve it somehow.


Tuesday, 17 December 2013

Why should you buy a Nexus device?

    




  •  There may be time when you see your friend buy an expensive phone and crib about it being laggy or slow. So what can be the alternative to all these "laggy phones"?
  • There may be time when you see your friend crib about latest android version not provided by their OEM. So what can you do in that scenario?
  • There may be time when your friend buys a phone which is available just in your country. It does not sell globally. And his phone develops some problem, And he comes to you to solve his problem. You try searching for the solution to that problem on Google. But his phone being a local one, not much support is available from  developers. Hence no relevant solution is available to you (Just limited solution by your local developers can be found). So what will you do in that scenario? [I am not at all saying that local community is not much helpful or active, just giving readers an idea of what they would be missing].
So what can you do, if you are stuck in above scenario? Not much. Because your friend has already done a mistake on his part to not buy a nexus device. But you can help your self by not doing that mistake.

So I would be writing in this post about why you should buy a nexus device. You would be thinking from where has this sudden love for android has awaken. But let me tell you it was already there. Before it was just limited to me, as I didn't wanted to force my love on everyone. But I have seen many people who don't know about nexus devices, their plus points, why they should prefer nexus devices above local manufacturers. Yes! believe me such people still exist. All they know is nexus devices are made by Asus/Lg, and the companies making them are not so famous or have bad customer support. But let me tell you that, along with Asus/Lg, nexus devices also have major connection with Google. By major I mean they provide the software for these phones. And till your bad customer support is concerned, I think these are global companies, so they ought to have nice support. Atleast better than what your local device maker is providing. Sometime slip ups occur from their part too. But that can be tolerated till you want an "proper" Android phone.






So, why should you buy an android phone?

  • Want to get Android updates quickly - Google providing software for your phone means they will keep you updated with whatever they release. So if you want to get android update quickly than you should not think beyond nexus devices. If you want a phone 
  •  Want to feel real Android - By real, I mean unadulterated form of android. Currently all OEM's are adulterating android by adding software from their part. Samsung adulterates android with their laggy TouchWiz, HTC does same by adding HTC sense. So you buy an nexus device, all you get with it is android. Nothing else. You are just provided with pure/Vanilla form of android.
  • Want a Cheap, yet quality phone -  Nexus devices are cheap as compared to other phones that provide similar hardware. All nexus devices are not so cheap (in all countries) but are quality products. And increased prices in some countries can be attributed to many reasons including tax, importing cost etc.
  •  Want to get Developer Support - Nexus devices are known for being developer friendly. And being a Google product, there is ought to be a global presence. And this results in plethora of developers striving hard to get you something different and better than what other devices are offering.
You have any other points to  include here or don't agree with any of my points here than do comment below. It will just make us both more wise.

Wednesday, 16 October 2013

Unusually Awesome Tools For Android

           
            Android is and will always be remembered for the applications and the levels of customization it provides. Application is something that is offered on other Operating System as well but what makes android different from other Operating Systems is that it provides apps that can make a difference to the way you use your phone and the way your phone behaves with you (Ofcourse I am talking about the apps which helps you control your processor, your cores, improves your user interface and improves your overall experience in using your phone. For this you'll have to root your droid, to know what do I mean by rooting, click me and here are the apps that will help you realize worthiness of rooting your droid, to know more about such apps click here). There are many android tools which will make you switch from an Apple device. This apps will let you help in many ways, there are some WiFi managers, app which will let you find some better apps according to the categories, some WiFi app which will help you manage your WiFi passwords, Some apps which will let you access sites which are restricted in your country. So this post is going to be an interesting one if you wish to continue reading. The apps mentioned here are tools which are very much unusual and helpful, many sites write about keyboards or some common apps that have very high downloads or are trending currently (yes, Its not wrong, but why read about apps that you know about already. So I am writing some apps which are remotely known to you. And definitely make you fall in love with it.

If you are low on time and want to hurry with the app name and link here it is. This is the short list of the apps which are explained in detail in post below -



The same apps are explained in details below, so that you can decide here itself about installing this apps.



Fing is the ultimate toolkit for network management, It has become one of my favorite app in recent time as it lets me know which devices are using my wireless network at a particular time. It is without any doubt the best app which lets you know who else is hogging your bandwidth.
Fing is a network discovery tool that finds devices connected to your network. It also features several networking utilities. Even though it's free, its developers aren't stingy with the feature set. - PCMAG 


Fetch is a app which will suggest you apps. It will help you in shortlisting or finding apps which are similar to apps which you have installed. Along with it, It will help you shortlist apps according to different categories like trending, most downloaded, top apps, top ranked, top rated, Fetch picks etc and yes it even sorts between paid and free. And it will let you follow some categories/feeds, so when new app is added you will know about it. So you can be sure that you are guaranteed to get some surprise, as you will definitely get some app which you would have believed never existed. So basically this is a app which will introduce you to other top apps in playstore.

Fetch gives you pretty much everything you might need in an app-discovery application. It offers a rich vein of filters and search functions which mean finding a list of great new apps and games is available in just a few seconds. I strongly recommend to anyone to check this app out; it’s powerful, user friendly and completely free, so definitely try it out. - AndroidTapp




Some times when many WiFi routers are using same channel to transmit signal it will lead to congestion and reduction in speed. So it is always recommended to be on a channel which is least crowded. So how will you know which channel is less crowded? This app will help you. It lists all the WiFi signal around your phone and sort it according to the channel it is using. So you can know which channel to use to get optimum bandwidth.
WiFi Analyzer offers five different ways to view wireless channels (some more valuable than others): Channel graph, Time graph, Channel rating, AP list, and Signal meter. To quickly switch between views, simply swipe left or right on your screen. Unfortunately, the different views are not labeled, so at first, it will probably take you a few minutes to figure out exactly what you're looking at. The app is not terribly difficult to use, but it does take some time to orient yourself. - CNET



 

DroidWall is an easy solution to save your data plan. As we all know, there are many apps which consist of advertisements. This ad can not only hinder with your data plan but may also compromise your privacy. So its better to use this app to block data usage by some apps which consume your data plan and may affect your user experience. So this app is like a firewall for your droid which won't let that app to use any bandwidth from your data plan. This app requires ROOT.

The privacy and security benefits of DroidWall are comparable to desktop PC firewalls and justify the effort it takes to root your phone. - Techhive

  • WiFi SIGNAL BOOSTER (Free)


This app don't do some black magic through which you will start receiving great download or WiFi speed. Only thing this app does is, it will just change your phone WiFi's sleep cycle so it will search for better signal more times than it would do without boost offered by this app. Just think of it as you want to gain some weight, So you will increase the amount of morsels you eat everyday, just because you want to increase some weight (I know its gross example, but this was the only thing that striked me while writing this post :P). So this app also works in same way, you want strong WiFi signal, you hit boost button. It will increase the frequency through with which it scans for signal ( In the same way as your weight gain example). Hence by more scanning, you get more strong signal.
[ This app worked for me 2 times out of 5 times I tried it, hope it works in your phone]




                        

There are times when your USB cable is not able to connect with your PC or laptop (Happens with me every time) or you don't have access to USB cable at particular moment. What will you do to transfer media files or any particular files from mobile to computer and vice-versa. This app comes to your help at that time. This app let you access your mobile from your machine, you just need your mobile and machine to be on same LAN network. It let you access your entire phone through web browser on your machine, including messages and contacts and even find your phone. So this can be your go to app if you are in trouble with your USB cable. 


This app will let you know the privacy quotient of the apps you have installed in your phone. This app categories your apps according to the privacy level and permissions it asks for. It also gives scores according to that apps. This app will help you remove potentially unwanted and high risk apps which can compromise your privacy or can harm your privacy. So this app is a must for anyone who likes to protect their privacy. 
Clueful provides helpful "clues" about Android app activity and potential security risks intended to let you decide whether an app is worth keeping or not. - PCMAG 







There are restrictions in many places about particular sites. So this app is a VPN (Virtual Private Network) which will help you connect to this site even if its restricted at your place. VPN service can help you to unblock regional internet restrictions, web filtering, bypass firewalls, and browse the web anonymously by tunneling all your internet traffic from your android device to their servers. This free app will let you transfer 100MB/day traffic. If you want to use more, then ofcourse you can subscribe to their servers. If your phone is below android 4.0 than you will have to root your phone to use this app.

       

How to measure that you are getting same bandwidth that you are told? This app lets you know the speed you are getting on your data plan. With this new version, Graphics have been enhanced many folds. This app is the best visual treat you can get from playstore among its competitors. This app lets you discover your Download, Upload and Ping.
Should you Download Speedtest.net? Essential app for checking your network mobile Internet speeds! - AndroidTapp

 

This app helps you to remove system apps (basically all that apps which are preinstalled, Sorry bad news for some people here! This app needs rooted phone) so basically it categories app according to its usefulness and notify us that removing particular app will lead to some damage or not. This app along with deleting system app also helps in app uninstaller, move app to SD card, move app to phone, apk on SD card scan/install/delete, rooting guide help.

  • WiFi PASS RECOVERY AND BACKUP (Free)

WiFi Pass Recovery and Backup is not some type of hacking tool, which will let you recover password of your neighbor or some one else's WiFi. It just saves password of WiFi which you have connected to before. Sometimes it happens that you have once entered password of your neighbor's WiFi in your phone then you forgot about it till you format your phone or factory reset it. At that time you won't recollect their password and asking your neighbour again can be rude. So what can you do? This app can be useful here, it collects stored password from your phone. Then ask you if you want to backup it or restore it. If you backup your WiFi settings you won't need to ask your neighbor about it again. you can directly recover it from this app. The saved file will be saved on your SD card. So it would be safe  even in case you format your phone.