小编Tob*_*run的帖子

Android资源转换为字符串TypedValue警告

好的,我正在寻找过去的东西......

每当我在我的应用程序中并且我更改活动时,logcat会报告一系列警告:

02-04 14:42:36.524: WARN/Resources(1832): Converting to string: TypedValue{t=0x12/d=0x0 a=2 r=0x7f08002b}
02-04 14:42:36.524: WARN/Resources(1832): Converting to string: TypedValue{t=0x12/d=0x0 a=2 r=0x7f08002c}
02-04 14:42:36.524: WARN/Resources(1832): Converting to string: TypedValue{t=0x12/d=0x0 a=2 r=0x7f08002d}
Run Code Online (Sandbox Code Playgroud)

其他应用程序没有显示此类警告.这是一个预发布/接受压缩的东西吗?

resources android

51
推荐指数
2
解决办法
2万
查看次数

UIAutomator根据索引点击listview

我正在尝试使用一般方法实现UIAutomator测试用例来执行ListView项目的单击(无论持有listitem的视图组的类型如何).

目前我有以下代码,但它一直点击第一项.

public void clickListViewItem(int index) throws UiObjectNotFoundException {
   UiObject listview = new UiObject(new UiSelector().className("android.widget.ListView"));
   if(index <= listview.getChildCount()){
      listview.getChild(new UiSelector().index(index)).click();
   }else{
       throw new UIObjectNotFoundException("Index is greater than listSize");
   }
}
Run Code Online (Sandbox Code Playgroud)

android listview android-uiautomator

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

android:将文件附加到邮件

我有这个发送邮件的代码:

Intent i = new Intent(Intent.ACTION_SEND);
i.setType("text/plain");
i.putExtra(Intent.EXTRA_EMAIL  , new String[]{"MyMail@gmail.com"});
i.putExtra(Intent.EXTRA_SUBJECT, "subject of email");
i.putExtra(Intent.EXTRA_TEXT   , "body of email");
try {
     startActivity(Intent.createChooser(i, "Send mail..."));
} catch (android.content.ActivityNotFoundException ex) {
     Toast.makeText(BladeActivity.this, "There are no email clients installed.", Toast.LENGTH_SHORT).show();
}
Run Code Online (Sandbox Code Playgroud)

如何附加到此邮件的文件: /sdcard/MyFile.csv

谢谢,

android email-attachments android-intent

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

Mapbox API /styles/v1/{username} 不反映最新的样式数据

使用 Mapbox 样式 API 调用更新样式 (POST) 或删除样式 (DELETE) 后,对列表样式 (GET /styles/v1/{username}) 的后续调用将返回过时的样式数据。例如,在调用 DELETE 然后调用 CREATE 后,GET 调用仍将返回已删除的样式!

等待大约 5 分钟通常会返回最新的、正确的样式数据。显然,Mapbox 端发生了一些缓存,但删除或更新应该立即反映出来。

有人确认或提供解决方法吗?

api mapbox

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

PHP 文件获取内容,http 版本

我正在使用 file_get_contents 函数来控制客户端,(例如http://ip:port/?light=on

在浏览器中使用相应的命令时它可以工作,当我将相同的 url 与 file_get_contents 函数结合使用时,它不起作用。

当我使用wireshark 请求时,我注意到浏览器使用的是http/1.1,而file_get_contents 使用的是http/1.0。

我相信 http 的版本是我的代码不起作用的问题,

如何在 de file_get_contents 函数中更改此版本的 http?或解决它?

php http file-get-contents

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

内部片段中的ViewPager,未显示,不可见

我使用ActionBar,它加载不同的碎片.这是在FragmentActivity类中完成的.其中一个Fragent应该有一个ViewPager包含不同的片段.我现在不再收到任何错误,但ViewPager和PagerTitleStrip以及ViewPager中的所有Fragents都没有显示出来.ActionBar中的其他片段正常工作.我正在使用Support-Package中的所有类.我在这里阅读了很多帖子,但我还是找不到它.

在我从FragmentAcivity派生的ActivityClass中,我使用了Listener:

SettingsActiviy.java

protected class SettingsTabsListener implements ActionBar.TabListener {

    private Fragment fragment;

    public SettingsTabsListener(Fragment fragment) {
        this.fragment = fragment;
        Log.e("SettingsTabListener","Contructor Fragment is " + fragment);
    }

    @Override
    public void onTabReselected(Tab tab, android.app.FragmentTransaction ft) {
    }

    @Override
    public void onTabSelected(Tab tab, android.app.FragmentTransaction ft) {
        FragmentManager fragMgr = getSupportFragmentManager();
        FragmentTransaction xaction=fragMgr.beginTransaction();

        // Dont know if we really need that...
        if (fragment instanceof SettingsActivityOverviewFragment) {
            if (fragment == null) {
                fragment = SettingsActivityOverviewFragment.newInstance(appWidgetId);
            }
        }
        xaction.replace(R.id.FragmentPlaceholder, (Fragment)fragment);
        xaction.commit();
    }

    @Override
    public void onTabUnselected(Tab …
Run Code Online (Sandbox Code Playgroud)

android android-fragments android-viewpager android-actionbar

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

Android NFC:其他RFID标签

我一直在寻找Android平台上的nfc,我有几个RFID标签,但他们不想与nexus进行交互.我相信这些标签并不是由andriod nfc模块支持的(例如,我可以阅读我的大学旧卡,这是mifare classic).作为参考我已经链接到销售这些东西的网上商店.可以在android上使用这些标签吗?是不是很多编码/黑客?

这是rfid标签的链接:http: //www.parallax.com/StoreSearchResults/tabid/768/txtSearch/tag/List/0/SortField/4/ProductID/693/Default.aspx

任何指导表示赞赏

android rfid nfc

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

Android:listview:自定义项:nullpointerexception,findviewbyid返回null

我一直在谷歌搜索和搜索解决这个错误一段时间,我似乎无法找出原因以及如何解决它.

我正在使用customAdapter填写我的列表视图.我膨胀描述我的listItem的xml.我使用findViewById创建viewHolder对象并在textview中加载.之后,我想设置该textview的文本,但findViewbyid返回一个空值.所以自动解析为nullpointerexception.

适配器:

/** CLASS : Custom Adapter for the listview */
private class CustomAdapter extends ArrayAdapter<Track>{
    private List<Track> items;
    private Context mContext;
    private int layoutResourceId;       
    private ViewHolder mHolder;

    public CustomAdapter(Context context, int layoutId, List<Track> objects) {
        super(context, layoutId, objects);
        layoutResourceId=layoutId;
        items = objects;
        mContext=context;       
    }       

    public View getView(int position, View convertView, ViewGroup parent) {
         if(convertView == null){
             LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
             convertView = inflater.inflate(layoutResourceId, parent, false);
             mHolder = new ViewHolder();
             ****** RETURNS NULL DURING DEBUGGING ******
             mHolder.textViewCenter = …
Run Code Online (Sandbox Code Playgroud)

android listview nullpointerexception adapter android-listview

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