【发布时间】:2013-04-09 11:25:58
【问题描述】:
我有一个用 c++ 编写的 ListComplexType 类型,它对从 Android 应用程序传递的文本进行一些解析。 ListComplexType 类型包含一个 std::list,填充有 MyComplexType。
现在我想将列表中 MyComplexType 对象的“名称”参数输出到 android 端的简单 ListView。
我该怎么做?我看过here。
例子:
C++:
class ListComplexType{
private:
std::string jsonString;//For testing!
list<MyComplexType> myList;
public:
ListComplexType(std::string jsonstring);
~ListComplexType();
void read( string jsonString);
std::string deserialize();
};
class MyComplexType{
public:
std::string name;
std::string phone;
Adress adress;
};
class Adress{
public:
double house;
std::string street;
};
JAVA:
json_parse(readJsonFile(getApplicationContext()));
Debug.stopMethodTracing();
mainListView = (ListView) findViewById( R.id.mainListView );
//RETRIEVE LIST FROM C++?
listAdapter = new ArrayAdapter<String>(this, R.layout.simplerow, list);
mainListView.setAdapter( listAdapter );
【问题讨论】:
标签: java c++ android-ndk java-native-interface