Back to project page android_bluetooth.
The source code is released under:
MIT License
If you think the Android project android_bluetooth listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.jayin.bluetooth; //from ww w .j a va 2 s . c om import java.io.Serializable; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Toast; /** * ??Activity??? * @author Jayin Ton * */ public abstract class BaseActivity extends Activity implements OnClickListener { protected abstract void initData(); protected abstract void initLayout(); /** * * ???Class<?> cls ??????Activity * @param cls */ public void openActivity(Class<?> cls) { this.startActivity(new Intent(this,cls)); } /** * ???intent?????????Activity * * @param intent */ public void openActivity(Intent intent) { this.startActivity(intent); } /** * ????Toast???toast?String content? * * @param content * content of your want to Toast */ public void toast(String content) { Toast.makeText(this, content, Toast.LENGTH_SHORT).show(); } /** * ??????findViewById(int id) * * @param id * @return */ public View _getView(int id) { return this.findViewById(id); } /** * ?class ????Intent; * * @param cls * @return */ public Intent wrapIntent(Class<?> cls) { return new Intent(this, cls); } /** * ??Activity */ public void closeActivity() { this.finish(); } /** * ????Activity?Context * * @return */ public Context getContext() { return this; } /** * ?? * @param content */ public void debug(String content){ Log.i("debug",this.getClass().getName()+":"+content); } /** * Get intent extra * * @param name * @return serializable */ @SuppressWarnings("unchecked") protected <V extends Serializable> V getSerializableExtra(final String name) { return (V) getIntent().getSerializableExtra(name); } /** * Get intent extra * * @param name * @return int */ protected int getIntExtra(final String name) { return getIntent().getIntExtra(name, -1); } /** * Get intent extra * * @param name * @return string */ protected String getStringExtra(final String name) { return getIntent().getStringExtra(name); } /** * Get intent extra * * @param name * @return string array */ protected String[] getStringArrayExtra(final String name) { return getIntent().getStringArrayExtra(name); } @Override public void onClick(View v) { } @Override protected void onDestroy() { super.onDestroy(); } @Override protected void onPause() { super.onPause(); } @Override protected void onStop() { super.onStop(); } @Override protected void onResume() { super.onResume(); } }