小编Nou*_*fal的帖子

使用蓝牙打印机从您的 Android 应用程序打印

我正在为 Android 设备开发一个 android 计费应用程序。在我的应用程序中,我必须在活动显示时以特定格式在蓝牙打印机中打印收据,如下所示。我必须打印整个屏幕,如下所示。我想知道如何识别最近的蓝牙打印机?如何配置它们?以及如何在蓝牙打印机中打印数据。该应用程序与以前的版本兼容。我搜索了很多,但没有得到任何积极的回应。

<uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="18" />
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

printing android bluetooth

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

RatingBar:相同评级两次

我的问题是,当我再次评定相同的值时,它没有第二次响应.这意味着当我第一次评价'4'时,我不能再次评价为'4' ..只有在我评价其他价值而不是'4'时才会回应.

这是我尝试过的(我需要getRatingBar在我的代码中执行操作).

public class InteractiveRatingBarActivity extends Activity implements
       OnRatingBarChangeListener {
   RatingBar getRatingBar;
   RatingBar setRatingBar;
   TextView countText;
   int count;
   float curRate;

   /** Called when the activity is first created. */
   @Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.activity_main);

       findViewsById();

       setRatingBar.setRating(curRate);//overall rating
       getRatingBar.setOnRatingBarChangeListener(this);// ratingbar for user action. 

   }   

   private void findViewsById() {
       getRatingBar = (RatingBar) findViewById(R.id.getRating);
       setRatingBar = (RatingBar) findViewById(R.id.setRating);
       countText = (TextView) findViewById(R.id.countText);
   }


   public void onRatingChanged(RatingBar rateBar, float rating,
           boolean fromUser) {
       DecimalFormat decimalFormat = new DecimalFormat("#.#"); …
Run Code Online (Sandbox Code Playgroud)

android ratingbar

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

如何在片段选项卡中包含活动?

我正在开发一个应用程序,其中有两个碎片标签.当按下标签时,会出现相应的碎片.这样可以正常工作.但是我想在碎片标签内部进行活动.我正在使用ABS库.

ActionBar bar = getSupportActionBar();
        bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
        ActionBar.Tab tab1 = bar.newTab();
        ActionBar.Tab tab2 = bar.newTab();
tab1.setText("Fragment A");
        tab2.setText("Fragment B");
tab1.setTabListener(new MyTabListener<FragmentA>(this, "tab1",
                FragmentA.class, null));
        tab2.setTabListener(new MyTabListener<FragmentB>(this, "tab1",
                FragmentB.class, null));
        }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
        case android.R.id.home:
            // app icon in action bar clicked; go Location selection
            Intent intent = new Intent(FragmentDemoActivity.this,
                    TestActivity.class);
             intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
             startActivity(intent);
             return true;
        default:
            return super.onOptionsItemSelected(item);
        }
    }

    @Override
    protected void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        outState.putInt("tab", getSupportActionBar()
                .getSelectedNavigationIndex());
    }
Run Code Online (Sandbox Code Playgroud)

listnerclass是

public class MyTabListener<T …
Run Code Online (Sandbox Code Playgroud)

android android-fragments actionbarsherlock

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

GoogleMap.OnMarkerDragListener无法正常工作

我很抱歉发布整个代码,以避免其他人的混淆.我在我的应用程序中成功地使用了GoogleMap,我也得到了我当前的位置.我的要求是获取放置标记的位置地址.标记是可拖动的,但是当我转移或标记从一个地方拖到另一个我没有得到任何东西,甚至没有log.I搜索约2天solution.Please尽力帮助我.这是我的Activity.I我提供的整个代码包括你更好理解的导入.

import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.location.Address;
import android.location.Geocoder;
import android.location.Location;
import android.os.Build;
import android.os.Bundle;
import android.support.design.widget.CoordinatorLayout;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
import com.google.android.gms.common.GooglePlayServicesRepairableException;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.location.places.Place;
import com.google.android.gms.location.places.ui.PlaceAutocomplete;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;

import java.util.List;
import java.util.Locale;

/**
 * Created by noufal …
Run Code Online (Sandbox Code Playgroud)

android google-maps google-maps-markers google-maps-android-api-2

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

有没有人将ODOO与Android集成在一起?

我目前正在为坚持使用Odoo for API的客户端开发一个android应用程序。我对此没有任何想法,即使在引用此链接后也没有得到它。他们提供了URL,数据库名称,用户名,以及密码。如果以前有人使用Android进行过Odoo的操作,您能提出建议吗?

android xml-rpc openerp odoo-mobile

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

为什么逻辑运算符,当java中有Bitwise运算符时

我知道Bitwise运算符&,| 和^是按位运算符或逻辑运算符...取决于操作数的类型.

如果操作数是整数,则运算符是按位的.如果他们是布尔,那么运营商是合乎逻辑的.

那么为什么有逻辑运算符&&,|| 和!?我相信在某些情况下我们只能使用逻辑运算符,所以它们就是这样.

那么,任何人都可以解释这种情况吗?或者比按位操作有任何优势.

java bitwise-operators logical-operators

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

从另一个应用程序启动应用程序,包括参数.

我有2个应用程序.App1和App2.App1:编辑文本+按钮App2:只是文本视图.

这是onClick按钮

        @Override
        public void onClick(View v) {

            Intent sendIntent =   getPackageManager().getLaunchIntentForPackage("com.example.app2");
            sendIntent.setAction(Intent.ACTION_SEND);
            sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my text to send.");
            sendIntent.setType("text/plain");
            startActivity(sendIntent);

        }
Run Code Online (Sandbox Code Playgroud)

App1应启动App2设置App2的文本视图

EditText text;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Intent intent = getIntent();
    String action = intent.getAction();
    String type = intent.getType();

    if (Intent.ACTION_SEND.equals(action) && type != null) {
        if ("text/plain".equals(type)) {
            String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT);
            text.setText(sharedText);
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

但我有nullpointerexception.请帮助和thx

android android-intent

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