我需要开发一个从OBD-II蓝牙适配器检索数据的Android应用程序.首先,我从https://code.google.com/p/android-obd-reader/下载了API,并尝试在其中运行示例应用程序,但它对我不起作用.有人能告诉我谁使用了该API以及该代码的错误在哪里?它上面有很多包和类.我无法澄清它们.
我正在尝试将一些数据发送到我的网站.单击该按钮时,需要将数据发送到网站
但是当我运行程序时,我遇到了一些错误
当我点击按钮时,此消息显示"不幸的是app已经停止",然后退出我的应用程序.
public class testInput extends Activity {
Button Setbutton;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.test_input_page);
Setbutton=(Button)findViewById(R.id.setbtn);
Setbutton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
testInput ti=new testInput();
//Create the intent
ti.postData("Sent Data");
});
}
public void postData(String toPost) {
// Create a new HttpClient and Post Header
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://mysite.com/index.php");
//This is the data to send
String MyName …Run Code Online (Sandbox Code Playgroud) 我想在我的应用程序中显示1到9个数字作为计数器
Run Code Online (Sandbox Code Playgroud)
TextView te=(TextView)findViewById(R.id.text);for(int i=0;i<10;i++ ){ try { te.setText("Number"+i); Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } }
但这并没有给我想要的我怎么能这样做
谢谢你