Android隐藏广告+指定日期运行程序
package lawdaquan.co.cc;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import net.miidi.credit.IAuxiliaryNotifier;
import net.miidi.credit.IOffersNotifier;
import net.miidi.credit.MiidiCredit;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.DialogInte易做图ce;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TextView;
public class LawdaquanActivity extends Activity implements IOffersNotifier,
IAuxiliaryNotifier {
private ImageView mImageView9;
private TextView mTextView9;
Handler mHandler;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MiidiCredit.init(this, "4610", "9kub15589v2d35xw", false);
setContentView(R.layout.main);
ImageView mImageView1 = (ImageView) findViewById(R.id.imageView1);
ImageView mImageView2 = (ImageView) findViewById(R.id.imageView2);
ImageView mImageView3 = (ImageView) findViewById(R.id.imageView3);
ImageView mImageView4 = (ImageView) findViewById(R.id.imageView4);
ImageView mImageView5 = (ImageView) findViewById(R.id.imageView5);
ImageView mImageView6 = (ImageView) findViewById(R.id.imageView6);
ImageView mImageView7 = (ImageView) findViewById(R.id.imageView7);
ImageView mImageView8 = (ImageView) findViewById(R.id.imageView8);
mImageView1.setOnClickListener(onclicklistener1);
mImageView2.setOnClickListener(onclicklistener2);
mImageView3.setOnClickListener(onclicklistener3);
mImageView4.setOnClickListener(onclicklistener4);
mImageView5.setOnClickListener(onclicklistener5);
mImageView6.setOnClickListener(onclicklistener6);
mImageView7.setOnClickListener(onclicklistener7);
mImageView8.setOnClickListener(onclicklistener8);
mImageView9 = (ImageView) findViewById(R.id.imageView9);
mTextView9 = (TextView) findViewById(R.id.textView9);
// SimpleDateFormat sdfTime = new
// SimpleDateFormat("yyyy-MM-dd,hh:mm:ss");
//
// String nowTime = sdfTime.format(new Date());
// StringBuffer sba = new StringBuffer();
// String astartTime = startTime.substring(0, 2);
// java.util.Date nowdate = new java.util.Date();
// String myString = "2008-09-08";
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd",
// Locale.CHINA);
// try {
// Date d = sdf.parse(myString);
// } catch (ParseException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// // boolean flag = d.before(nowdate);
// String s1 = "2012-5-25 04:40:09";
// String s2="2008-01-29 09:12:11";
//
// java.text.DateFormat df = new java.text.SimpleDateFormat(
// "yyyy-MM-dd HH:mm:ss");
// java.util.Calendar c1 = java.util.Calendar.getInstance();
// java.util.Calendar c2 = java.util.Calendar.getInstance();
// try {
// c1.setTime(df.parse(s1));
// c2.setTime(df.parse(s2));
//
// } catch (Exception e) {
// // TODO: handle exception
// }
// int result=c1.compareTo(c2);
// if (result>) {
//
// }
String s1 = "2012-5-28 12:00:00";
// SimpleDateFormat formatter = new
// SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
SimpleDateFormat sDateFormat = new SimpleDateFormat(
"yyyy-MM-dd hh:mm:ss");
String date = sDateFormat.format(new java.util.Date());
// String str = formatter.format(curDate);
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar c1 = Calendar.getInstance();
Calendar str = Calendar.getInstance();
try {
c1.setTime(df.parse(s1));
str.setTime(df.parse(date));
} catch (Exception e) {
// TODO: handle exception
}
int result = c1.compareTo(str);
// if (result == 0)
// System.out.println("当前时间等于系统时间");
if (result < 0) {
System.out.println("当前时间小于系统时间");
mImageView9.setVisibility(View.VISIBLE);
mTextView9.setVisibility(View.VISIBLE);
} else {
System.out.println("当前时间大于系统时间");
mImageView9.setVisibility(View.INVISIBLE);
mTextView9.setVisibility(View.INVISIBLE);
}
// mTextView9.setText(str);
mImageView9.setOnClickListener(onclicklistener9);
// if (str-oooString) {
//
// mImageView9.setVisibility(View.VISIBLE);
//
// }
MiidiCredit.setOffersListener(this);
MiidiCredit.setAuxiliaryListener(this);
}
private OnClickListener onclicklistener9 = new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
MiidiCredit.showAppOffers();
}
};
private OnClickListener onclicklistener1 = new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent1 = new Intent(LawdaquanActivity.this, xingfa.class);
startActivity(intent1);
}
};
private OnClickListener onclicklistener2 = new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent2 = new Intent(LawdaquanActivity.this, minfa.class);
startActivity(intent2);
}
};
private OnClickListener onclicklistener3 = new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent3 = new Intent(LawdaquanActivity.this, chufa.class);
startActivity(intent3);
}
};
private OnClickListener onclicklistener4 = new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent4 = new Intent(LawdaquanActivity.this, xingsu.class);
startActivity(intent4);
}
};
private OnClickListener onclicklistener5 = new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent5 = new Intent(LawdaquanActivity.this, minsu.cl
补充:移动开发 , Android ,