我正在尝试在Android上开发一个安全应用程序,我想迭代一个特定目录的文件名,以便我可以比较目录中每个文件的哈希值.
我已经找到了如何进行散列但是对于迭代部分我很困惑它是如何工作的.
我目前正在尝试开发一个SMS应用程序,并允许用户向多人发送短信.
由于SMS很长,我必须使用下面的sendMultipartTextMessage
private void sendSMS(final String phoneNumber, String message) {
String SENT = "SMS_SENT";
String DELIVERED = "SMS_DELIVERED";
SmsManager sms = SmsManager.getDefault();
ArrayList<String> parts = sms.divideMessage(message);
int messageCount = parts.size();
Log.i("Message Count", "Message Count: " + messageCount);
ArrayList<PendingIntent> deliveryIntents = new ArrayList<PendingIntent>();
ArrayList<PendingIntent> sentIntents = new ArrayList<PendingIntent>();
PendingIntent sentPI = PendingIntent.getBroadcast(this, 0, new Intent(SENT), 0);
PendingIntent deliveredPI = PendingIntent.getBroadcast(this, 0, new Intent(DELIVERED), 0);
for (int j = 0; j < messageCount; j++) {
sentIntents.add(sentPI);
deliveryIntents.add(deliveredPI);
}
// ---when the SMS …Run Code Online (Sandbox Code Playgroud) 如何在android中清除整个通话记录历史记录?目前我有这个代码,只能清除特定的通话记录
public void DeleteCallLogByNumber(String number) {
String queryString="NUMBER="+number;
this.getContentResolver().delete(CallLog.Calls.CONTENT_URI,queryString,null);
}
}
Run Code Online (Sandbox Code Playgroud) 我试图在基础适配器上实现一个getFilter()来过滤掉List上的搜索结果.有没有关于如何实现getFilter()的示例?
MainActivity.java
final AppInfoAdapter adapter = new AppInfoAdapter(this, Utilities.getSystemFilteredApplication(this), getPackageManager());
public void onTextChanged(CharSequence s, int start, int before,
int count) {
adapter.getFilter().filter(s); //Filter from my adapter
adapter.notifyDataSetChanged(); //Update my view
}
Run Code Online (Sandbox Code Playgroud)
AppInfoAdapter.java
package com.example.permission;
import java.util.List;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.Filter;
import android.widget.Filterable;
import android.widget.ImageView;
import android.widget.TextView;
public class AppInfoAdapter extends BaseAdapter implements Filterable{
private Context mContext;
private List mListAppInfo;
PackageManager mPackManager;
public AppInfoAdapter(Context c, List list, …Run Code Online (Sandbox Code Playgroud) 我试图在执行方法时将“isPhysicalTheftEnabled”设置为 false,但这似乎不起作用。任何人有任何想法?
SharedPreferences sp = getSharedPreferences("isPhysicalTheftEnabled", MODE_WORLD_READABLE);
SharedPreferences.Editor ed = sp.edit();
ed.putBoolean("isPhysicalTheftEnabled", false);
Run Code Online (Sandbox Code Playgroud) 我正在尝试使这个ListView工作,我正在尝试按应用程序名称而不是包名称按字母顺序对列表进行排序.
MainActivity.java
// load list application
mListAppInfo = (ListView)findViewById(R.id.lvApps);
// create new adapter
AppInfoAdapter adapter = new AppInfoAdapter(this, Utilities.getInstalledApplication(this), getPackageManager());
// set adapter to list view
mListAppInfo.setAdapter(adapter);
Run Code Online (Sandbox Code Playgroud)
AppInfoAdapter.java
public AppInfoAdapter(Context c, List list, PackageManager pm) {
mContext = c;
mListAppInfo = list;
mPackManager = pm;
}
public View getView(int position, View convertView, ViewGroup parent) {
// get the selected entry
ApplicationInfo entry = (ApplicationInfo) mListAppInfo.get(position);
// reference to convertView
View v = convertView;
// inflate new layout if null
if(v …Run Code Online (Sandbox Code Playgroud) 我有一个BroadcastReceiver,我试图检测系统启动何时完成,但接收器没有被解雇,或LogCat中没有任何想法?
AndroidManifest
<!-- SIM Card Receiver -->
<receiver android:name=".SIMChangeNotifierActivity" android:enabled="true" android:exported="false">
<intent-filter android:priority="1001">
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
Run Code Online (Sandbox Code Playgroud)
广播接收器
public class SIMChangeNotifierActivity extends BroadcastReceiver {
public void onReceive(Context context, Intent intent)
{
if("android.intent.action.BOOT_COMPLETED".equals(intent.getAction()))
{
Log.e("TAG", "Boot completed");
}
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试开发Android防病毒软件,我试图找出可行的方法.
到目前为止,我发现了一种唯一的方法是使用PackageManager并获取已安装的应用程序列表及其包名称,并将其与黑名单进行比较.有没有更好的解决方法?