小编Ant*_*tto的帖子

android.content.res.Resurces $ NotFoundException:字符串资源ID#0x0

请帮帮我,我无法弄清楚为什么会出现这个错误.就在一天前,它奏效了.我理解它的serches和id ist'n存在,但id在xml中.它在这里给我错误,onCreate方法:

public class DoExamActivity extends Activity {
    private DatabaseHandler db;
    private EditText votoET;
    @Override
    public void onCreate(Bundle savedInstanceState) { 
        super.onCreate(savedInstanceState);
        setContentView(R.layout.do_exam);
        Bundle bundle = getIntent().getExtras();

        db = new DatabaseHandler(getApplicationContext());

        try {
            transcript = new JSONObject(bundle.getString("transcript"));
            exam = new JSONObject(bundle.getString("exam"));
            teacher = new JSONObject(bundle.getString("teacher"));
        } catch (JSONException e) {
            e.printStackTrace();
        }

        votoET = (EditText) findViewById(R.id.examValueET); //here
Run Code Online (Sandbox Code Playgroud)

这是do_exam.xml他无法找到的编辑文本.你可以看到id在那里!

        <TableRow
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >

            <ImageView
                android:layout_height="30dp"
                android:layout_gravity="left|center_vertical"
                android:layout_weight="1"
                android:background="@color/ios7orange"
                android:contentDescription="@string/textValueDescr"
                android:src="@drawable/rating_star" />

            <TextView
                android:layout_height="50dp"
                android:layout_weight="1" />

            <EditText
                android:id="@+id/examValueET" …
Run Code Online (Sandbox Code Playgroud)

xml android

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

来自ArrayAdapter的getFragmentManager

我有一个listView来自我的自定义ArrayAdapter.在每个视图中都有一个按钮.我想在单击按钮时更改当前片段.这是我的代码:

public class CheckInSArrayAdapter extends ArrayAdapter<JSONObject> {


    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        return getViewOptimize(position, convertView, parent);
    }

    public View getViewOptimize(int position, View convertView, ViewGroup parent) {

    ......

        viewHolder.commentBtn.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {

            ??? <<<<<

        });

        return convertView;
    }

    private class ViewHolder {
        ...       
        public Button commentBtn;
    }

}
Run Code Online (Sandbox Code Playgroud)

所以现在,我无法从OnClickListener调用getFragmentManager.我能怎么做?

android

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

Xamarin Forms Dependency Service 定义问题

我正在使用 Xamarin 开发和应用程序,我正在尝试遵循本指南,以便为 UWP 的 Xamarin Forms 实现和接口。

所以我用PCL写了这个界面:

namespace MyApp {
public interface ISimplePdfLoader {

    void OpenLocal(string uri);

    void Load(object pdfDoc);
  }
}
Run Code Online (Sandbox Code Playgroud)

在 MyApp.UWP 中,我创建了一个类:

[assembly: Dependency(typeof(SimplePdfLoader))]
namespace MyApp.UWP {
public class SimplePdfLoader : ISimplePdfLoader {

    public async void OpenLocal(string uri) {
        ...

        Load(doc);
    }

    public async void Load(object pdfObj) {
        ...
        }
    }
}
}
Run Code Online (Sandbox Code Playgroud)

但它继续显示error CS7036 No arguments matching the mandatory formal parameter 'loadHintArgument' of 'DependencyAttribute.DependencyAttribute (string, LoadHint)'指定的 MyApp.UWP C:\Users...\workspace\my-app\MyApp\MyApp.UWP\SimplePdfLoader.cs 19 并且我无法编译该项目。 …

c# xamarin xamarin.forms uwp

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

标签 统计

android ×2

c# ×1

uwp ×1

xamarin ×1

xamarin.forms ×1

xml ×1