小编Kum*_*mar的帖子

当小吃栏在Android中显示时,浮动动作按钮不会上升

  1. 我在我的应用程序中使用小吃栏和FAB同一页,每当Snackbar显示浮动操作按钮不上升.

  2. 我使用第三方库attachToListView工作正常

    import com.melnykov.fab.FloatingActionButton;
    
    Run Code Online (Sandbox Code Playgroud)

如果我使用默认库"无法解析attachToListView"

import android.support.design.widget.FloatingActionButton;
Run Code Online (Sandbox Code Playgroud)

我的需要:

  1. attachToListView应该工作(当Listview向下滚动FAB时将消失).

  2. 每当Snackbar显示浮动操作按钮时应该上升.

帮帮我如何解决这个问题.

第三方图书馆链接

编辑:1

我删除了第三方库添加了默认导入(导入android.support.design.widget.FloatingActionButton),FAB正在上升但是Attachtolistivew没有解决.

编辑:2

我使用Listview在我的活动中,使用FAB和Snackbar.所以我需要像FAB一样的两个选项在Snackbar打开时以及当Listview向下滚动时应该隐藏FAB.

我的SnackBar代码:

 Snackbar snack = Snackbar.make(fab1, " Successfully ...!",Snackbar.LENGTH_SHORT);
                    View snackbarView = snack.getView();
                    snackbarView.setBackgroundColor(Color.parseColor("#f44336"));
                    snack.show();
Run Code Online (Sandbox Code Playgroud)

Main.java

import com.melnykov.fab.FloatingActionButton;
     @Override
        protected void onCreate(Bundle savedInstanceState) 
    {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.fabview);

            fab1 = (FloatingActionButton) findViewById(R.id.fab);

            fab1.setShadow(true);
            //fab.attachToListView(provider_service_list);

            //FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
            fab1.attachToListView(listViewData, new ScrollDirectionListener()
            {
                @Override
                public void onScrollDown() {
                    Log.d("ListViewFragment", "onScrollDown()"); …
Run Code Online (Sandbox Code Playgroud)

android floating-action-button android-snackbar

18
推荐指数
2
解决办法
8903
查看次数

来自Url的Json Parsing在Android中,不起作用

我正在从URL解析数据,其得到下面提到的错误.

原始数据从Server.Iot能够使用Json解析分割数据完美显示.

请帮我解决这个错误

编辑:1

来自URL的Json响应

[
    {
        "ID": 4,
        "Name": "Vinoth",
        "Contact": "1111111111",
        "Msg": "1"
    },
    {
        "ID": 5,
        "Name": "Mani",
        "Contact": "22222222",
        "Msg": "1"
    },
    {
        "ID": 6,
        "Name": "Manoj",
        "Contact": "33333333333",
        "Msg": "1"
    }
]
Run Code Online (Sandbox Code Playgroud)

错误:

org.json.JSONException: Value [{"ID":1,"Name":"Lalita","Contact":"9997162499","Msg":"1"},{"ID":2,"Name":"kumar","Contact":"123456789","Msg":"1"}] of type java.lang.String cannot be converted to JSONArray
12-11 18:23:27.249 30195-30195/com.knowledgeflex.restapidemo W/System.err:     at org.json.JSON.typeMismatch(JSON.java:111)
12-11 18:23:27.249 30195-30195/com.knowledgeflex.restapidemo W/System.err:     at org.json.JSONArray.<init>(JSONArray.java:96)
12-11 18:23:27.249 30195-30195/com.knowledgeflex.restapidemo W/System.err:     at org.json.JSONArray.<init>(JSONArray.java:108)
12-11 18:23:27.249 30195-30195/com.knowledgeflex.restapidemo W/System.err:     at com.knowledgeflex.restapidemo.MainActivity$LoadService.onPostExecute(MainActivity.java:135)
12-11 18:23:27.249 30195-30195/com.knowledgeflex.restapidemo W/System.err:     at com.knowledgeflex.restapidemo.MainActivity$LoadService.onPostExecute(MainActivity.java:58) …
Run Code Online (Sandbox Code Playgroud)

parsing android json

11
推荐指数
3
解决办法
1726
查看次数

从List Inside Listview中播放音频,但Seekbar未在Android Listview项目中更新

  1. 我正在播放Uri的音频工作正常.
  2. 单击每个Listview项目中的按钮.

问题:音频正在Listview中播放,但Seekbar仍未移动(正在更新).

编辑:1

1. 音频正在每个Listview项目中完美播放,但是Seekbar不工作(不更新).

请帮我解决这个问题.

我的Listview数组适配器类:

Adapter.class

     private static final int UPDATE_FREQUENCY = 500;

 int progress=0;

        public View getView(final int position, View view, ViewGroup parent) {
            LayoutInflater inflater = context.getLayoutInflater();
            View rowView = inflater.inflate(R.layout.audio_listview, null, true);


            ListenAUdioButton = (Button) rowView.findViewById(R.id.ListenAudiobuttonxml);
            seek_bar_view = (SeekBar) rowView.findViewById(R.id.seek_bar);
            ListenAUdioButton.setOnClickListener(new View.OnClickListener() {
                public void onClick(View v) {
                    // text_shown.setText("Playing...");
                    try {


                        try {
                            // get Internet status
                            isInternetPresent = cd1.isConnectingToInternet();
                            // check …
Run Code Online (Sandbox Code Playgroud)

audio android listview android-mediaplayer

10
推荐指数
1
解决办法
792
查看次数

调用服务类在应用程序启动的一天中,在Android中启动,耗电量更少

当用户在Android中每天启动一次应用程序时,我想调用服务类.

清单代码:

<service android:name=".DailyRemainder" >
            <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
            </intent-filter>
        </service>
Run Code Online (Sandbox Code Playgroud)

Java代码:

 // for Repeating Process
    Intent myIntent = new     Intent(sign_in.this,.DailyRemainder.class);
    pendingIntent1 = PendingIntent.getService(sign_in.this, 0,myIntent, 0);
   AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
   Calendar calendar = Calendar.getInstance();
     calendar.setTimeInMillis(System.currentTimeMillis());
     calendar.add(Calendar.SECOND, 20); alarmManager.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), pendingIntent1);
  alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), 24*60*60*1000, pendingIntent1);
Run Code Online (Sandbox Code Playgroud)

以上代码在后台运行我的移动电池,但我需要当用户启动应用程序时,服务应该运行一天一次.如何实现这一目标.

service android alarmmanager

9
推荐指数
2
解决办法
1378
查看次数

当使用Retrofit从服务器到本地数据库同步数据时,为什么Android Circle进度对话框会冻结

1. 在Android中登录时,我从服务器获取大量数据并插入本地数据库.

2.用于同步目的我使用了改造库,同步和插入工作正常.

我的问题:从服务器同步数据同时使用改造,循环进度对话框获得冻结.

帮助我解决此问题.

编辑:1

在Async任务中调用Retrofit方法,Still Circle ProgressDialog获取冻结

//调用异步任务

Asynctask_Getdata task=new Asynctask_Getdata(TokenType_StringValue,Access_Token_StringValue, ID_StringValue);
   task.execute();
Run Code Online (Sandbox Code Playgroud)

// AsyncTask方法

public class Asynctask_Getdata extends AsyncTask<String,Void,Void>
    {

        String TokenType_StringValueitem;
        String Access_Token_StringValueitem;
        String ID_StringValueitem;

        public Asynctask_Getdata(String tokenType_StringValueitem, String access_Token_StringValueitem, String ID_StringValueitem) {
            TokenType_StringValueitem = tokenType_StringValueitem;
            Access_Token_StringValueitem = access_Token_StringValueitem;
           ID_StringValueitem = ID_StringValueitem;
        }

        @Override
        protected void onPreExecute()
        {
            super.onPreExecute();

            if (!pDialog.isShowing())
            {
                pDialog.setIndeterminate(true);
                pDialog.setCanceledOnTouchOutside(false);
                pDialog.setMessage("Please Wait Getting Data...");
                pDialog.show();
            }
        }

        @Override
        protected void onPostExecute(Void aVoid) …
Run Code Online (Sandbox Code Playgroud)

android progressdialog progress-bar retrofit

9
推荐指数
1
解决办法
1088
查看次数

如何避免启动Android应用程序两次,从Eclipse运行到真实设备

我正在从eclipse运行应用程序并且它正在启动两次:第一次启动应用程序,然后在几秒钟后再次重新启动

我的应用程序启动画面--- >>主要活动(两次打开两次).

我已经尝试在我的清单文件中添加 android:launchMode ="singleInstance",但没有成功.

我已经尝试了3种不同的应用程序,从我的日食仍然在我的Kitkat,棒棒糖真实设备中打开两次(创建了一个也打开两次的新项目)

编辑1:

尝试在清单文件中添加此行而不是成功 - android:launchMode ="singleTop"

请让我知道如何解决这个问题.

清单文件:

<application
        android:allowBackup="true"
        android:icon="@drawable/logo"
        android:label="@string/app_name"
        android:largeHeap="true"
        android:launchMode="singleInstance"
        android:theme="@style/AppTheme2" >


        <activity
            android:name=".Start"
            android:label="@string/app_name"
            android:screenOrientation="portrait" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".MainActivity"
            android:screenOrientation="portrait" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
</application>
Run Code Online (Sandbox Code Playgroud)

我的开始是Activity.java

public class Start extends Activity
{


        SessionManagerFor_Signin session;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);


        // Session class instance
        session = new SessionManagerFor_Signin(getApplicationContext());

         // …
Run Code Online (Sandbox Code Playgroud)

eclipse android android-manifest main-activity

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

发布已签名的Android应用,Google Plus登录和Google地图无效

1.我在我的Android应用程序中使用谷歌加登录谷歌地图.

2.在调试应用程序从Android Studio到Real设备(移动)谷歌加登录和谷歌地图工作正常.(一切正常)

问题:

1.Build - >生成签名APK - 来自android Studio,我发布了apk无法使用Google plus登录.

2.此外,谷歌地图显示空白屏幕.

我尝试从Google Developer Console 创建OAuth客户端ID及其Giving Error消息

错误消息: 重复指纹您指定的指纹已被此项目或其他项目中的Android OAuth2客户端ID使用

链接我参考谷歌加登录

请帮助我任何人如何解决它.

编辑:1

1.我测试了debug.apk它完美的Google加登录和地图.

但是没有在release.apk中工作.帮我解决问题.

android google-maps google-api google-plus google-play-services

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

从Azure获取结果插入行并在Azure数据库中插入后从本地数据库中删除行数据

1.我的应用程序是每2分钟数据插入本地数据库(使用Azure脱机同步),然后每5分钟数据与后台服务同步到Azure数据库.

2.在AZURE服务器中插入后的每行数据,我想从本地数据库中删除.

我的问题:

1.我怎么知道我的每一行都是在服务器中插入的.任何响应都将从服务器发送回客户端.还有其他解决方案吗?.

2.从本地Sqlite中删除在Azure服务器中插入的行(在从Azure服务器插入后获得构造之后).

另外,我想使用Azure方法检索本地数据库中保存的数据.

我正在使用Azure Cloud for Server End.

链接我从Sqlite引用了脱机Azure同步

android azure azure-storage azure-mobile-services

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

Android GPS启用/禁用时间保存在带有多条线的SDCARD内的文本文件中

1.我正在使用SD卡内的文本日志文件保存Android GPS启用和禁用时间.

我想打印多行文本,而不删除上一行数据.

下面的代码是完美打印多行,但当应用程序保持睡眠和重新启动时.当GPS开启或关闭时,与先前数据一起打印一行.

帮我解决一下.

Required Output:(after Restart the app)

<< GPs Enabled At :2016/06/08 17.15.00>>
<< GPs Disabled At :2016/06/08 17.45.00>>
<< GPs Enabled At :2016/06/08 17.49.00>>
<< GPs Disabled At :2016/06/08 17.52.00>>

Getting Output:(after Restart the app)

<< GPs Enabled At :2016/06/08 17.15.00>>
<< GPs Disabled At :2016/06/08 17.45.00>>
<< GPs Enabled At :2016/06/08 17.49.00>>
<< GPs Disabled At :2016/06/08 17.52.00>>
<< GPs Disabled At :2016/06/08 17.52.00>>
<< GPs Disabled At :2016/06/08 17.52.00>>
Run Code Online (Sandbox Code Playgroud)

日志文件的方法:

 public void Logmethod(String NoramalStr,String …
Run Code Online (Sandbox Code Playgroud)

gps android

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

使用AsyncTask在Background服务中添加android进度对话框,获取FATAL异常

  1. Iam 从预定服务中调用Asynctask每10分钟就会运行一次.

  2. 运行Service时,Progress对话框OnpreExecute获取Exception .

错误:

FATAL EXCEPTION: main                                                                                    
android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
at android.view.ViewRootImpl.setView(ViewRootImpl.java:594)

at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:259)

at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)

at android.app.Dialog.show(Dialog.java:286)
Run Code Online (Sandbox Code Playgroud)

编辑1: 警报管理器每5分钟调用一次服务

/*Alarm manager Service for From Server*/
private void setServerFetch() {
    // for  to Server to GPS PING
    Intent myIntent1 = new Intent(LoginPage.this, AlarmService.class);
    pendingintent1 = PendingIntent.getService(LoginPage.this, 1111, myIntent1, 0);
    AlarmManager alarmManager5 = (AlarmManager) getSystemService(ALARM_SERVICE);
    Calendar calendar1 = Calendar.getInstance();
    calendar1.setTimeInMillis(System.currentTimeMillis());
    calendar1.add(Calendar.SECOND, 1);
    alarmManager5.set(AlarmManager.RTC_WAKEUP, …
Run Code Online (Sandbox Code Playgroud)

service android progressdialog android-asynctask android-pendingintent

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