当前位置: 编程技术>移动开发
本页文章导读:
▪apk装配器 apk安装器
File file = new File(filePath); Intent intent = new Intent(); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setAction(Intent.ACTION_VIEW); String type = "application/vnd.android.package-archive"; intent.s.........
▪ Intent传送对象 Intent传递对象
Person person = new Person();
intent.putExtra("person",person);
and for reading back use like this.
Person person = (Person)data.getParcelableExtra(name);
import android.os.Parcel;
import android.os.Parcelable;
public class Pers.........
▪ listView处置OnTouchListener GestureDetector listView处理OnTouchListener GestureDetector
gestureDetector = new GestureDetector(new MyGestureDetector());
gestureListener = new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
if.........
[1]apk装配器
来源: 互联网 发布时间: 2014-02-18
apk安装器
File file = new File(filePath);
Intent intent = new Intent();
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setAction(Intent.ACTION_VIEW);
String type = "application/vnd.android.package-archive";
intent.setDataAndType(Uri.fromFile(file), type);
startActivity(intent);
注:filePath为apk路径
[2] Intent传送对象
来源: 互联网 发布时间: 2014-02-18
Intent传递对象
Person person = new Person();
intent.putExtra("person",person);
and for reading back use like this.
Person person = (Person)data.getParcelableExtra(name);
import android.os.Parcel;
import android.os.Parcelable;
public class Person implements Parcelable
{
private String Name = "anupama";
private String Address = "India";
private int Age = 30;
@Override
public int describeContents()
{
// TODO Auto-generated method stub
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flag)
{
// TODO Auto-generated method stub
dest.writeString(Name);
dest.writeString(Address);
dest.writeInt(Age);
}
public Person(Parcel in)
{
this.Name = in.readString();
this.Address = in.readString();
this.Age = in.readInt();
}
@SuppressWarnings("unchecked")
public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
public Person createFromParcel(Parcel in)
{
return new Person(in);
}
public Person[] newArray(int size)
{
return new Person[size];
}
};
}
[3] listView处置OnTouchListener GestureDetector
来源: 互联网 发布时间: 2014-02-18
listView处理OnTouchListener GestureDetector
gestureDetector = new GestureDetector(new MyGestureDetector());
gestureListener = new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
if (gestureDetector.onTouchEvent(event)) {
return true;
}
return false;
}
};
mList.setOnTouchListener(gestureListener);
最新技术文章: