Android class where i was wrong

public class temp 
    public int data0;//整数
    public int data1;//小数
    public int data2;
    public int data3;
    public long firsttime;
    public temp(int type,int data0, int data1, int data2, int data3,
             long firsttime) {
        this.data0 = data0;
        this.data1 = data1;
        this.data2 = data2;
        this.data3 = data3;
        this.firsttime = firsttime;

public class ShareDate {

   public static temp mtemp=null;
   public static date mdate=null;


the problem is in MainActivity I did like this


then the program was stopped unexpected. I don't know where it's wrong?


where is your initialization code?

mtemp=new temp();

A class's object must be initialized to use its data member/Methods.

You need to initialize before object use.. There is no initialization code..

mtemp=new temp();

And why u use constructor?

If you use ,

ShareDate.mtemp.date0=20;  like this ,,

no need a constructor.

Need Your Help

Search Within Text Files (.doc, .docx, .pdf etc) in mysql database

php mysql pdf docx

I want to make a module which search within a files (file type: .doc, .docx, .pdf). By using "file_get_contents()" I can find the files but for that I have to specify the location where all the fil...

How to call a newly added WCF method from code behind?

c# .net wcf silverlight

How to call the below SaveData method from xaml.cs