嗨,我正在开发一个Android Gallery应用程序,我从内置库中获取图像并显示它.我正在使用如下代码
String[] projection = {MediaStore.Images.Thumbnails._ID};
Cursor cursor = getContentResolver().query(MediaStore.Images.Thumbnails.INTERNAL_CONTENT_URI,
projection, // Which columns to return
null, // Return all rows
null,
null);
int columnIndex = cursor.getColumnIndexOrThrow(MediaStore.Images.Thumbnails._ID);
int size = cursor.getCount();
// If size is 0, there are no images on the SD Card.
if (size == 0)
{
Log.e("size 0","0");
}
Run Code Online (Sandbox Code Playgroud)
问题是,当我在仅具有内部存储(Galaxy Nexus)的手机上运行此代码时,即使内置图库中有图像,我也会收到大小为零的Log.我该如何解决这个问题.请帮忙.谢谢!
我正在开发一个Android应用程序,用于每天,每周,每月设置警报.通过将给定日期和时间转换为毫秒,前两个工作正常.但是,当我试图每月做同样的事情时,它不起作用.日期格式完全不同.
我的设置如下,
Alarmtimefor30具有给定的日期(以毫秒为单位).
am.setRepeating(AlarmManager.RTC_WAKEUP, alarmTimefor30, 30*1440*60000 , pi);
Run Code Online (Sandbox Code Playgroud)
我将intervalMillis设为30*1440*60000,结果为2592000000,即30天(毫秒).当我尝试打印30*1440*60000时,结果为1702967296.我不确定可能是什么问题.
是否有另一种方法来设置月度警报(每月特定日期和时间触发)?
请帮忙!谢谢!
嗨,我正在处理消息设置作为首选项.
我想改变android:title和android:CheckboxPreference的摘要文本字体大小.

为此,我正在尝试下面的代码
<PreferenceCategory
android:key="prefcategory1"
android:title="GENERAL SETTINGS..." >
<CheckBoxPreference
android:defaultValue="false"
android:enabled="true"
android:key="checkBoxdelete"
android:layout="@layout/mylayout" <!--linking it to mylayout.xml -->
android:summary="Deletes old messages as limits are reached"
android:title="Delete old messages" />
</PreferenceCategory>
Run Code Online (Sandbox Code Playgroud)
和mylayout.xml
<TextView android:id="@+android:id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="8dp"
android:textColor="#FFFFFF"
android:textSize="30px"
android:textStyle="bold"/>
<TextView android:id="@+android:id/summary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="8dp"
android:textColor="#FFFFFF"
android:textSize="20px"
android:textStyle="bold"/>
Run Code Online (Sandbox Code Playgroud)
通过使用它,文本大小增加,如下面的屏幕截图.但是,我无法看到复选框..如何解决这个问题?

android android-preferences checkboxpreference listpreference
嗨,我正在开发Android Gallery应用程序.我从SD卡中的文件夹中获取图像并将其显示在网格视图中,如下所示
public static ArrayList<String> getFilePaths()
{
ArrayList<String> filePaths = new ArrayList<String>();
File directory = new File(android.os.Environment.getExternalStorageDirectory() + File.separator + AppConstant.PHOTO_ALBUM);
// check for directory
if (directory.isDirectory())
{
// getting list of file paths
File[] listFiles = directory.listFiles();
// Check for count
if (listFiles.length > 0)
{
for (int i = 0; i < listFiles.length; i++)
{
String filePath = listFiles[i].getAbsolutePath();
if (IsSupportedFile(filePath))
{
// Add image path to array list
filePaths.add(filePath);
}
}
}
else
{
// image directory …Run Code Online (Sandbox Code Playgroud) 我正在开发一个Android应用程序,我想打开电池使用意图,它以编程方式关注设备部分.我正在使用以下代码.
Intent i = new Intent();
i.setAction(android.provider.Settings.ACTION_DEVICE_INFO_SETTINGS);
startActivity(i);
Run Code Online (Sandbox Code Playgroud)
上面的代码打开关于设备意图.但我想打开设置的关于设备部分内的电池使用选项.没有得到如何做到这一点.请帮忙!谢谢!
嗨,我正在开发一个根据SIM状态更改按钮的应用程序
我使用1表示无SIM卡,5表示SIM READY
在少数情况下我没有服务,例如,如果SIM卡是国际卡,它在其他地方不起作用.这种情况的SIM状态是什么.
请建议如何检查何时有SIM卡但没有服务.谢谢!
嗨,我正在开发自定义视频应用程序.我能够获得currentCameraId 通过
currentCameraId = Camera.CameraInfo.CAMERA_FACING_BACK;
Run Code Online (Sandbox Code Playgroud)
我有两个问题要问:
1)如何只用前置摄像头检测Android设备.
因为在Micromax标签中只有前置摄像头的平板电脑上,currentCameraId为0.
2)如何检查相机闪光灯的可用性,因为下面的代码在某些手机上不起作用
flash = this.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH);
Run Code Online (Sandbox Code Playgroud)
请帮忙.
谢谢!
flash android android-package-managers android-camera front-camera