Android General

How to switch between Activities in Android

To switch Menus/Activities in Android App
public void backToMainMenu(View view){ 
	Intent i = new Intent(getApplicationContext(), PreviousMenuClassName.class);
  1. I called this function in XML file as¬†android:onClick=”backToMainMenu” in the attributes of button.
  2. The function must be public and have only one attribute i.e. “View view”
  3. You can call “i” whatever you wish.
  4. “PreviousMenuClassName” is the name of the Activity where you want to go after clicking the button.

Android adding camera in app

So why not use the camera that already exists in your Android Phone!

First put the following in AndroidManifest.xml before the <application…></application> tag

<uses-feature android:name="" />

Then go to the MainActivity class or wherever you want to call “Camera opening function”. Add the following function:

public void startCamera(View view){ Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivity(takePictureIntent); }
  1. Here, startCamera is a function called when a button is pressed.
  2. The default camera app of your phone opens and you will have all the advanced features without any work.
  3. Done ūüėÄ

Knoppix touchpad click workaround

Problem:¬†I can’t click with my touchpad in Knoppix. I can use USB/bluetooth mouse normally but the Laptop’s touchpad can’t be tapped to click.


  1. Go to terminal and enter the following

    knoppix@Microknoppix:~$ synclient Tapbutton1=1

  2. Now try closing the terminal by tapping the [X] in the terminal window and it will work.

Note: This only works for the current session which means if you restart knoppix, the touchpad will be back to unclickable. I will update the post as soon as I discover the permanent solution to the problem. But as far as I am concerned, I can do that on every boot ūüôā



Installing, running and testing and stopping Xampp services in Knoppix

Knoppix is very portable and easy to use. Being a developer, I know that it is important to keep your tools handy.  This post is about installing Xampp in Knoppix. The following steps can get it running in no time ;D

  1. Get the latest .tar.gz of Xampp and download it in a folder.
  2. Go to the downloaded file’s folder using File Manager.
  3. Open Terminal in the¬†.tar.gz¬†file’s folder by pressing

    Tools>Open Current Folder in Terminal

The next step will Install Xampp in /opt folder.

  1. Type the following command in the terminal (make sure the name of the .tar.gz file is correct)

…:~$¬†sudo tar xvfs NAME OF FILE.tar.gz -C/opt

Afterwards, you will see a lot of installation activity in the terminal window. When it finishes, it is necessary to change permissions to the htdocs folder in xampp in order to make development easy and possible.

  1. Type the following in Terminal to allow file permissions in htdocs

…:~$¬†chmod 777 /opt/lampp/htdocs

  1. Now we can start Xampp

…:~$¬†/opt/lampp/lampp start

  1. Now go to browser and type localhost and it will be working fine. Also check if phpmyadmin is working.
  1. To stop Xampp services, go to terminal and type this

…:~$¬†/opt/lampp/lampp stop

  1. Enjoy! ūüôā



Installing WINE in knoppix (CD and DVD)

Wine in Knoppix CD version

Type the following in Terminal

knoppix@Microknoppix:~$ sudo apt-get update

It will download and install wine along with its required repositories. Afterwards, you can install Wine by typing sudo apt-get install wine1.5.

knoppix@Microknoppix:~$ sudo apt-get install wine1.5

Afterwards, if you with to install a Windows program in Knoppix, then simply copy the setup on the desktop (makes it easy) and then click the setup file. If everything was set properly, then Wine will appear to install the program. It is important to note that some programs require some files (such as .dll files) which are mostly provided in Windows but not in Linux. Therefore it is important that those files are to be copied in the required folders.

Wine in Knoppix DVD version

As for those users of Knoppix who intend to use the DVD version, then there is no need to install anything because Wine comes as a pre-installed package in the DVD version.


Sublime Text default theme for Netbeans IDE

I like the Sublime Text theme because it is easy to look at and everything looks readable. This is a must-have theme for Netbeans. It looks exactly like Sublime text and you sill keep all the features of Netbeans.

The installation of this theme is very simple.


  1. Click Options.
  2. Click Fonts & Colors.
  3. At bottom left, click Import.
  4. Click Browse button.
  5. Select the Downloaded file (which in my instance was
  6. Well, finally select the theme as shown below and click apply.



I hope this enhances your experience with development of your projects. Don’t forget to share ¬†;D

Codeigniter Uncategorized

Codeigniter 2.20 – How to manage assets (js, jpg etc) (using View)

Back to CodeIgniter Tutorials

In this guide, you will learn to use CSS and JS files by calling them from the VIEW (not the controller). In the coming lessons, I will also write on importing assets using Controller but here, we are using views.

  • First, install Codeigniter using the method as described¬†here.
  • Then make your own homepage using the method explained¬†here.

Now that we are set up, lets get started!

  1. Go to your Codeigniter folder and add a folder called assets such that it should look like this yourwebsite/assets/ For reference, look at the following

    codeigniter assets folder
    codeigniter assets folder
  2. Inside /assets/ create three folders which should look like this
    1. CSS folder named css
    2. Javascript folder named javascript 
  3. In the css folder, create style.css
  4. In the javascript folder, create scripts.js
  5. Go to your homepage and paste the following in the <head> tag.
    <script src="http://localhost/yourwebsite/assets/javascript/my-script.js">
    css" href="http://localhost/yourwebsite/assets/css/style.css">
  6. That is all. You can similarly add jquery and images in the same fashion. In order to confirm that the CSS and javascript is loaded, you can check source of the loaded page and click on the .css and .js files

Please note that this guide is applicable on using XAMPP. For web server, you may have different folder paths for example:

<link rel="stylesheet" href="<?php echo base_url("assets/cover.css"); ?>">

I hope you find this tutorial informational. Do not forget to comment and share ūüôā

Back to CodeIgniter Tutorials