小编Rah*_*hul的帖子

我们如何防止服务被操作系统杀死?

Service在我的应用程序中使用它需要运行,直到我的应用程序被卸载,但问题是它被操作系统杀死.

我们怎样才能防止它被操作系统杀死?或者,如果它被杀死,我们可以通过编程方式再次重启该服务吗?

android android-service

45
推荐指数
6
解决办法
6万
查看次数

如何在 Android 的列表视图中显示音频文件?

我在SD 卡上的特定目录中有一些音频文件。我需要在 Android 的列表视图中显示他们的名字,如果我想播放或删除该特定文件,我可以通过该列表视图执行此操作吗?我该怎么做?

public class MyPerformanceArrayAdapter extends ArrayAdapter<String> {
    private final Context context;
    private final String[] values;

    public MyPerformanceArrayAdapter(Context context, String[] values) {
        super(context, R.layout.main, values);
        this.context = context;
        this.values = values;
    }           

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        LayoutInflater inflater = (LayoutInflater) context
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View rowView = inflater.inflate(R.layout.main, parent, false);
        TextView textView = (TextView) rowView.findViewById(R.id.label);
        ImageView imageView = (ImageView) rowView.findViewById(R.id.icon);
        textView.setText(values[position]);
        // Change the icon for Windows and iPhone
        String s = …
Run Code Online (Sandbox Code Playgroud)

audio android listview android-layout

5
推荐指数
1
解决办法
7577
查看次数

错误:在Android中处理PNG图像失败

我已将我的图像保存在res/drawable文件夹中,但它仍然在控制台上给我这个错误

[2012-04-28 18:36:46 - Local] libpng error: Not a PNG file
[2012-04-28 18:36:46 - Local] ERROR: Failure processing PNG image D:\Android2_worksapce\Local\res\drawable-ldpi\ic_launcher.png
[2012-04-28 18:36:46 - Local] libpng error: Not a PNG file
[2012-04-28 18:36:46 - Local] ERROR: Failure processing PNG image D:\Android2_worksapce\Local\res\drawable-mdpi\ic_launcher.png
[2012-04-28 18:36:46 - Local] D:\Android2_worksapce\Local\res\layout\aboutus.xml:2: error: Error: No resource found that matches the given name (at 'background' with value '@drawable/about').
[2012-04-28 18:36:46 - Local] D:\Android2_worksapce\Local\res\layout\autofare.xml:2: error: Error: No resource found that matches the given name (at 'background' …
Run Code Online (Sandbox Code Playgroud)

xml android android-layout

1
推荐指数
1
解决办法
9135
查看次数

标签 统计

android ×3

android-layout ×2

android-service ×1

audio ×1

listview ×1

xml ×1