WELCOME

WELCOME TO TECH-VILLA.

SEARCH YOUR TECHNICAL STUFF

OR

BROWSE THROUGH LABELS IN SIDEBAR

HAPPY BLOGGING.

Tuesday, March 31, 2015

Stackoverflow is down for everyone

StackOverflow.com is down everywhere.


Saturday, July 16, 2011

How to send JSON data on server in Android.

Below is the link to my answer on stackoverflow.com. There is a code snippet which you can use directly to POST JSON data to webservice or remote server.
Here is the Link.: Click Here..

Thanks
Ninad.

Sunday, March 6, 2011

android- how to invoke email client in android and add multiple attachments to it.

This is very common task in android to invoke email client from your application. there are many tutorial available out there about how to invoke email client in apps and add attachment to email client....


but i faced the real prob when i had to attach multiple attachments in email. i had searched a lot and finally implemented it correctly.


So here is a short tutorial on how to add multiple attachments to email client in android


you will have to start with a Intent with Intent.ACTION_SEND_MULTIPLE
 //here is the intent
final Intent ei = new Intent(Intent.ACTION_SEND_MULTIPLE);
//set the type of data
//application/octet-stream gives only email options. messaging and bluetooth will not show up in the application chooser
ei.setType("application/octet-stream");
// set the email address, you want in "To" field
ei.putExtra(Intent.EXTRA_EMAIL, new String[] {"me@somewhere.nodomain"});
// add subject
ei.putExtra(Intent.EXTRA_SUBJECT, "That one works");
 
Now here comes the main part which will attach the multiple attachments in email
 
first we will make an array list of Uris...as follows .....
ArrayList<Uri> uris = new ArrayList<Uri>();
 suppose u have to attach two files then take there locations and parse them to Uris....File fileIn1 = new File(filepath1);
        Uri u1 = Uri.fromFile(fileIn1);
File fileIn2 = new File(filepath2);
        Uri u2 = Uri.fromFile(fileIn2);
 now we will add these Uri to array list
 
uris.add(u1);
uris.add(u2);
 // add these uris to intent.
ei.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris); 
 
and just start the activity..... 
startActivityForResult(Intent.createChooser(ei, "Sending multiple attachment"), 12345);
 
So here's the complete code....
 
final Intent ei = new Intent(Intent.ACTION_SEND_MULTIPLE);
ei.setType("application/octet-stream");
ei.putExtra(Intent.EXTRA_EMAIL, new String[] {"me@somewhere.nodomain"});
ei.putExtra(Intent.EXTRA_SUBJECT, "That one works");
 
ArrayList<Uri> uris = new ArrayList<Uri>();

File fileIn1 = new File(filepath1);
        Uri u1 = Uri.fromFile(fileIn1);
File fileIn2 = new File(filepath2);
        Uri u2 = Uri.fromFile(fileIn2);
uris.add(u1);
ei.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
startActivityForResult(Intent.createChooser(ei, "Sending multiple attachment"), 12345);
 
So done with the multiple attachments in the email clien from android app.... 
 
 
 
 
 
 

Saturday, February 26, 2011

how to make a list in android/ List View in android/ Adapters in android

ListView is one of the most commonly used View in android. I observed that most of the newbie in android find it very difficult to implement it.

So lets start our work with a simple code example...
here are the steps.
  1. Make a class that extends ListActivity.
  2. Make your own custom Adapter class. Now what this custom adapter class do is set our data and inflate layout on for listview.
  3. Override the required set of methods in your custom adapter class.
  4. that is it.....still have confusions? It seems there are lots of confusions. Then have a look at the code snippet. This might solve all your confusions......

public class ListExample extends ListActivity {//extend your class with ListActivity.
 
    private MyAdapter mAdapter;//Make an instance of your custom Adapter Class(MyAdapter).
 
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mAdapter = new MyAdapter();
        for (int i = 0; i < 124; i++) {
            mAdapter.addItem("Data " + i);//Add some Data to your adapter.
        }
        setListAdapter(mAdapter);//now set this adapter to your list
    }
 /**this is your custom adapter class.
*/
    private class MyAdapter extends BaseAdapter {
 
        private ArrayList mData = new ArrayList();
        private LayoutInflater mInflater;
 
        public MyAdapter() {
            mInflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        }
 
        public void addItem(final String item) {
            mData.add(item);
            notifyDataSetChanged();
        }
 
        @Override
        public int getCount() {//this defines the size of the list.
            return mData.size();
        }
 
        @Override
        public String getItem(int position) {
            return mData.get(position);
        }
 
        @Override
        public long getItemId(int position) {
            return position;
        }
       /**getView is called internally by adapter to generate the view of he rows of the list*/ 
 
        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            System.out.println("getView " + position + " " + convertView);
            ViewHolder holder = null;
            if (convertView == null) {
                convertView = mInflater.inflate(R.layout.item1, null);
                holder = new ViewHolder();
                holder.textView = (TextView)convertView.findViewById(R.id.text);
                convertView.setTag(holder);
            } else {
                holder = (ViewHolder)convertView.getTag();
            }
            holder.textView.setText(mData.get(position));
            return convertView;
        }
 
    }
 
    public static class ViewHolder {
        public TextView textView;
    }
}
 now the most important method in this adapter class is getView method. if you want to make your own custom list containing some images, text etc then you will have to override this method properly.

What this method does is it generates the view of each row of list, as soon as you scroll the list. getView gets called each time you move through the list. It inflates the new layout from the layout resources or uses the recycled layout from the recycler to generate the view of list rows. 
Here comes the new word 'Recycler'. Actually what android does is it stores only those items in the memory which are visible+ one view in Recycler.
As we run our application, this getView method will be called and it  inflates layout from resources for all the visible items. But when  we scroll through our list, the item that scrolls out of the screen moves to Recyler.
then to display next item getView does not inflate layout  from resources but it uses the view that has already been stored in Recycler.

when there is no view available in the recycler then the parameter "convertView" in the getView method gets a null value. So that we can inflate layout on the basis of this value.

 I found an Image on Internet, i thought this would help you to visualize the  getView properly.


We did the similar thing in the above example......

Sunday, October 24, 2010

Android???? What's that!

Introduction:

Android is one of the most heard Buzzword these days. Android is one of the leading Operating System for mobile devices. It is developed by google and it is unique in the sense as it is an Open Source project. Google is actively developing and consistently making refinements to it, so as to make it No.1 OS for mobile devices.

Open Handset Alliance:
Google formed a group of hardware, software, and telecommunication companies called the Open Handset Alliance with the goal of contributing to Android development. 
There are lots of android phones available in the market. Big Companies like HTC, Samsung, LG are actively partcipating in the development of android based devices. Android devices are available in various configurations as android supports many screen sizes and resolutions, sensors etc....


Android Market
Android have a dedicated Application Store/Market known as 'Android Market'. There are loads of applications available in this  market for users. Most of the applicaton are free for download and some are available in free as well paid version for download.


Following are the versions of android released till date......
Android 1.5(Cupcake), 1.6, 2.0, 2.1, 2.2, Android 2.3(GingerBread), and Latest(till date) one is HoneyComb(3.0)...


For how to develop for android keep reading the further post......

Wednesday, February 10, 2010

Tuesday, January 26, 2010

Error opening in pendrive

when all the methods u know, to save ur pendrive, fails then only u should resort to this method. I have tried it myself and it worked very well.(If there is no physical damage)

For this u have to have a bootable CD eg......like Bootable Windows XP, 2000.

just plugin your pendrive and start the PC, Insert the Bootable CD, & press any key to boot it. (for this process first bootable device have to be selected as CD)

you will be entered into the OS installation process.

do the same process which you do while installing windows untill the CREATE PARTITION WIZARD comes.

in this u can see the Hard Disks of your PC along with the PENDRIVE's memory at the bottom.....................

u can easily recognise it from its memory (Like if u r using 2GB pendrive, it will show memory like 1952 MB)

select it.................. then press (D) to delete it, after deleting it press (C) to create a new partition of it
and give the full memory space which it take by default........................................

Its done............................................. just press F3 to quit from the installation process, remove the CD
and start the PC normally. & see your pendrive working accurately.

you should be very carefull while selecting the partition to delete coz otherwise u will loose your previous data of other drive.

Wednesday, January 20, 2010

Programme in C without main()

this is very simple and small  trick in C
a progrmme in c with out using a main function.
#include
#define decode(s,t,u,m,p,e,d)m##s##u##t
#define begin decode(a,n,i,m,a,t,e)
int begin()
{
printf("HELLO")
}

N-JOY

Thursday, January 14, 2010

Storage Management

PURPOSE OF THE PROJECT:
This Project Mainly Designed for Creating database for examination for Storing and Retreving materials from administrator to staff members
Application functions.
application developer
adminstrator for login
create a table for registration  for staff and admin
create a table for apply online
All data should be saved to the data base    

Download The Project

Sunday, January 10, 2010

consumer complaints

consumer complaints

consumers (complaint givers) table creation linmen table creation new (complaints storer) table creation close_list table creation assignment table creation view for report generation to JE/ADE/DE view for report generation to staff

Download The Project

Wednesday, January 6, 2010

Pizza Orders- Student Information

INTRODUCTION VISUAL BASIC DATABASE PROJECTS contains three programs you can use at home. The programs illustrate advanced uses of Visual Basic with databases. Topics covered include using the ADO .NET data objects, data bound controls, relational database design, graphics and printing. This free product has the actual Visual Basic source code for VISUAL BASIC DATABASE PROJECTS that you can study and modify, as you desire. You should be able to understand this code if you have completed our VISUAL BASIC AND DATABASES course. Check our website for all of our tutorials.

Download Project

School-Management-System

School-Management-System This is a medium sized project for managing educational institutes. Current version of this project includes Student Management System, some forms for managing Staff, Batches etc. We are continuously working on this project and we will update the latest versions when available. This is an ideal project for MCA and Engineering students who want to do academic project using C#. You can download the source code and use this as a template. Even though we have implemented many features, you can extend it by adding several new features to it. Feel free to write to us if you have any questions or if you have suggestions for improvement. Upcoming features include 'Marks', 'Attendance', 'Librabry Management' and more...

Download Project

Flight Reservation

PURPOSE OF THE PROJECT:
This is only for those who are going to reserve the flight tickets through online
Application functions.
application developer
adminstrator for login
create a table for registration  for staff and admin
create a table for apply online
All data should be saved to the data base    


Download The Project


Savings Bank - Joint Account

PURPOSE OF THE PROJECT:

This project is designed for the co-operative bank to provide internet operations to the existing savings bank customers and also the same to new customers. Staff handles the provision of joint account facilities and entitled to view and update facilities which are created.

Application functions.

Entering user id and password in login screen. Viewing account Details of joint account facilities. Entering new ATM/ Cheque book details for providing joint account facilities. Editing and updating ATM/ Cheque book details of an existing joint account details. All data should be saved to the data base

Download The Project

Bank To Customer I bank Solution

PURPOSE OF THE PROJECT:

Application Needed by Co-operative Bank which provides B2C operations as i-Bank Solution

Client Requirement

Internationalization of Banking operations like Savings Bank Account Fixed Deposits, Loans against Fixed Deposits Between Customer and Bank with Internet as medium to provide On the bench Banking

Solution:

A web Application developed in correspondence to Clients Requirement Interfaces provided according to the usage 1) Customer interface 2) Clerk/Staff interface

Download The Project

Computerized Internal Evaluation Test

As the name suggests, the aim of this project is to computerize the entire process of conducting Internal examinations for B-Tech students.

Download the Project

Hostel Management System

Download the Project