我正在尝试进行不适用的演示.我按照本教程学习这个.
Lemme告诉我执行此任务所遵循的步骤
我使用了下面提到的代码
package com.ohn.inappbilling;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import com.hello.inappbilling.util.IabHelper;
import com.hello.inappbilling.util.IabResult;
import com.hello.inappbilling.util.Inventory;
import com.hello.inappbilling.util.Purchase;
import com.ohn.inappbilling.R;
public class MainActivity extends ActionBarActivity {
private static final String TAG = "com.hello.inappbilling";
static final String ITEM_SKU = "com.buttonclick";
IabHelper mHelper;
private Button clickButton;
private Button buyButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
buyButton = (Button) findViewById(R.id.buyButton);
clickButton = (Button) findViewById(R.id.clickButton);
clickButton.setEnabled(false);
String base64EncodedPublicKey = "******";
mHelper = new …Run Code Online (Sandbox Code Playgroud)我正在使用asmack和xmpp进行文件共享.我能够发送文件,但无法在另一台设备上接收文件.我做了很多研究和开发,发现很多方法尝试了所有这些但没有取得成功.似乎我犯了任何小错误,尝试了很多,但没有解决我的问题.我用来发送文件的代码是:
d.findViewById(R.id.btnsendphoto).setOnClickListener(
new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if (!filepath.equals("")) {
configureProviderManager(connection);
FileTransferNegotiator.IBB_ONLY = true;
FileTransferNegotiator.setServiceEnabled(
connection, true);
mFileTransferManager = new FileTransferManager(
connection);
String to = connection.getRoster()
.getPresence("cac6ba9dc9c6ac67@pc")
.getFrom();
final OutgoingFileTransfer transfer = mFileTransferManager
.createOutgoingFileTransfer(to);
File file = new File(filepath);
try {
configureProviderManager(connection);
transfer.sendFile(file, "test_file");
} catch (XMPPException e) {
e.printStackTrace();
}
new AsyncTask<Void, Void, Void>() {
protected void onPreExecute() {
}
@Override
protected Void doInBackground(
Void... params) {
while (!transfer.isDone()) { …Run Code Online (Sandbox Code Playgroud)