基本信息
源码名称:安卓图片拍照上传 示例源码
源码大小:14.47M
文件格式:.rar
开发语言:Java
更新时间:2018-01-24
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
服务端已验证通过,《猪肉溯源》app源码
服务端已验证通过,《猪肉溯源》app源码
package com.zte2014.zms.pork.activity;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewConfiguration;
import android.view.Window;
import android.widget.ImageView;
import android.widget.LinearLayout;
import com.zte2014.zms.pork.R;
public class IndexActivity extends Activity {
private ImageView index_menbtn;
private LinearLayout index_lay_sy;
private ImageView index_img_sy;
private LinearLayout index_lay_scan;
private ImageView index_img_scan;
private LinearLayout index_lay_tz;
private LinearLayout index_lay_yl;
private ImageView index_img_yl;
private LinearLayout index_lay_rk;
private ImageView index_img_rk;
private LinearLayout index_lay_sc;
private ImageView index_img_sc;
private LinearLayout index_lay_fh;
private ImageView index_img_fh;
private LinearLayout index_lay_jc;
private ImageView index_img_jc;
private LinearLayout index_sccj;
private ImageView index_img_sccj;
private LinearLayout index_lay_sfjd;
private ImageView index_img_sfjd;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_index);
bindViews();
setOverflowShowingAlways();
index_lay_tz.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent scanIntent=new Intent();
scanIntent.setClass(IndexActivity.this,TzActivity.class);
startActivity(scanIntent);
overridePendingTransition(R.anim.slide_in_right,R.anim.slide_out_left);
}
});
index_lay_scan.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent scanIntent=new Intent();
scanIntent.setClass(IndexActivity.this,CaptureActivity.class);
startActivity(scanIntent);
overridePendingTransition(R.anim.slide_in_right,R.anim.slide_out_left);
}
});
index_lay_sy.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent scanIntent=new Intent();
scanIntent.setClass(IndexActivity.this,SyActivity.class);
startActivity(scanIntent);
overridePendingTransition(R.anim.slide_in_right,R.anim.slide_out_left);
}
});
}
private void setOverflowShowingAlways() {
try {
//使用放射 ,欺骗系统,本手机是没有menu键的
ViewConfiguration config = ViewConfiguration.get(this);
Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
menuKeyField.setAccessible(true);
menuKeyField.setBoolean(config, false);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public boolean onMenuOpened(int featureId, Menu menu) {
if (featureId == Window.FEATURE_ACTION_BAR && menu != null) {
//使用反射,强制显示图标
if (menu.getClass().getSimpleName().equals("MenuBuilder")) {
try {
Method m = menu.getClass().getDeclaredMethod("setOptionalIconsVisible", Boolean.TYPE);
m.setAccessible(true);
m.invoke(menu, true);
} catch (Exception e) {
}
}
}
return super.onMenuOpened(featureId, menu);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.index, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
switch (id) {
case R.id.actionbar_exit:
{
new AlertDialog.Builder(IndexActivity.this).setTitle("警告!您将退出登录账号!")
.setMessage("您确定要退出?")
.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
/* SharedPreferences sp = IndexActivity.this.getSharedPreferences("userinfo", Context.MODE_PRIVATE);
Editor editor=sp.edit();
editor.putBoolean("loginflage", false);
editor.putString("username", "all");
editor.commit();*/
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
System.exit(0);
}
}).setNegativeButton("取消", null).show();
break;
}
case R.id.actionbar_settings:
{
return true;
}
default:
break;
}
return super.onOptionsItemSelected(item);
}
private void bindViews() {
index_menbtn = (ImageView) findViewById(R.id.index_menbtn);
index_lay_sy=(LinearLayout)findViewById(R.id.index_lay_sy);
index_img_sy = (ImageView) findViewById(R.id.index_img_sy);
index_lay_scan = (LinearLayout) findViewById(R.id.index_lay_scan);
index_img_scan = (ImageView) findViewById(R.id.index_img_scan);
index_lay_tz=(LinearLayout)findViewById(R.id.index_lay_tz);
index_lay_rk = (LinearLayout) findViewById(R.id.index_lay_rk);
index_img_rk = (ImageView) findViewById(R.id.index_img_rk);
index_lay_fh = (LinearLayout) findViewById(R.id.index_lay_fh);
index_img_fh = (ImageView) findViewById(R.id.index_img_fh);
index_lay_jc = (LinearLayout) findViewById(R.id.index_lay_jc);
index_img_jc = (ImageView) findViewById(R.id.index_img_jc);
}
}