小编Aks*_*iom的帖子

Eclipse Luna的Velocity编辑器插件

我正在为Eclipse Luna搜索Velocity编辑器插件,但我找不到任何东西.我找到了几个编辑器插件,如:

  1. Veloeclipse
  2. 速度编辑器
  3. Veloedit <--------------- 现在正在研究Luna 4.4.1!
  4. 二七区
  5. Velocity Web Edit

这些都不适用于Eclipse Luna.有没有其他人知道在Eclipse Luna中编辑Velocity文件的任何其他插件?

先感谢您!

eclipse velocity eclipse-plugin

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

没有调用Android OnNewIntent

我看到了几种方法,我尝试了一切,但无法使它工作.我不知道为什么它如此复杂,在文档中它看起来如此简单!我想通过通知触发OnNewIntent(用户在通知栏中单击它).

目前我已将Activity设置为singleTop

<activity
    android:name="-.-.-.MainMenuActivity"
    android:launchMode="singleTop"
    android:screenOrientation="portrait" >
</activity>
Run Code Online (Sandbox Code Playgroud)

这是我创建通知的代码:

public void showNotification(String text, String componentId){
    NotificationCompat.Builder mBuilder =
            new NotificationCompat.Builder(this)
            .setSmallIcon(R.drawable.logo)
            .setContentTitle("Title")   
            .setAutoCancel(true)
            .setContentText(text);

    // Creates an explicit intent for an Activity in your app
    Intent resultIntent = new Intent(this, MainMenuActivity.class);
    if(!componentId.equalsIgnoreCase("")){                         
        resultIntent.putExtra("componentId", componentId);
    }   
    resultIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);

    PendingIntent resultPendingIntent = PendingIntent.getActivity(this, 0, resultIntent, 0);
    mBuilder.setFullScreenIntent(resultPendingIntent, false);
    mBuilder.setContentIntent(resultPendingIntent);
    NotificationManager mNotificationManager =
        (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    // mId allows you to update the notification later on.
    mNotificationManager.notify(0, mBuilder.build());
}
Run Code Online (Sandbox Code Playgroud)

这是我的MainMenuActivity中的OnNewIntent方法:

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

notifications android push-notification onnewintent

12
推荐指数
2
解决办法
9613
查看次数

PendingIntent获取requestCode

我用a AlarmManager来启动服务.当我设置AlarmManager我使用PendingIntent并使用一个唯一的requestCode,它等于我的数据库中的id行.

PendingIntent pendingIntent = PendingIntent.getBroadcast(SettingsActivity.this,
                            lecture.getId(), myIntent, 0); 
Run Code Online (Sandbox Code Playgroud)

如何在启动时在我的服务中检索该ID?我基本上只需要requestCode参数.我想使用该id从我的数据库中检索数据并在通知中显示它.我已经实现了所有的东西,我只需要requestCode.有可能得到它吗?

谢谢

notifications android broadcastreceiver alarmmanager android-pendingintent

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

NotificationCompat和setFullScreenIntent()

我想知道是否有人对这种类型的通知有一些经验.

在我的用例中,我想触发来自我的服务的通知,而不是应该打开全屏视频.方法setFullScreenIntent看起来对这个问题是正确的,因为在它写的文档中:

启动而不是将通知发布到状态栏的意图.仅适用于要求用户立即关注的极高优先级通知,例如用户明确设置为特定时间的来电或闹钟.

所以它说它就像打电话一样.这意味着即使我的手机处于睡眠状态,我也应该全屏查看通知.

但在我的情况下,我只是得到单挑通知,如果我点击它就会打开活动.即使在文档中他们也提到过这种行为......

在某些平台上,系统UI可以选择在用户使用设备时显示抬头通知,而不是启动此意图.

...我想知道在触发通知时如何自动打开活动.就像来电电话屏幕一样.

这是我的服务代码:

@Override
public int onStartCommand(Intent intent, int flags, int startId) {


    Intent notificationIntent = new Intent("android.intent.category.LAUNCHER");
    intent.setClassName("com.example.test",
            "com.example.test.VideoActivity");
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

    PendingIntent contentIntent = PendingIntent.getActivity(getApplicationContext(), 0, notificationIntent, 0);

    NotificationCompat.Builder mBuilder =
                new NotificationCompat.Builder(this)
                .setSmallIcon(R.drawable.ic_launcher)
                .setContentIntent(contentIntent)
                .setContentTitle("Video")
                .setContentText("Play video")
                .setFullScreenIntent(contentIntent, true);

    NotificationManager mNotificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);



    mNotificationManager.notify(0, mBuilder.build());

    return Service.START_STICKY;
}
Run Code Online (Sandbox Code Playgroud)

service android android-intent android-notifications

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

DialogInterface vs View OnClickListeners

为什么我不能同时进口OnClickListener.我已经import android.view.View.OnClickListener;但是当我想添加import android.content.DialogInterface.OnClickListener;它时给了我一个错误:

导入android.content.DialogInterface.OnClickListener与另一个import语句冲突

这就是为什么,例如,我必须编写OnClickListener我需要实现的完整命名空间的原因DialogInterface OnClickListener(即

.setPositiveButton(R.string.ok, new android.content.DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {

                }
            })
Run Code Online (Sandbox Code Playgroud)

谁能解释一下这个?如果这是一个愚蠢的问题,我道歉.

java android collision onclicklistener

6
推荐指数
1
解决办法
4824
查看次数

ListVIew在Google Glass上

是否有可能在Google Glass上实现列表外观和功能(滚动显示头部移动)列表,如主玻璃屏幕上的列表.

我提到的列表在Glass上看起来像这样:

在此输入图像描述

我找不到任何关于此的文档,所以任何帮助将不胜感激.

android list google-glass

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

从我的适配器中刷新ExpandableListView

我发现只有一个类似的问题而且对我没有帮助.我希望你能帮助我,因为我被困住了.

这是我的自定义适配器(仅限相关部分):

MyExpandableListAdapter:

public class MyExpandableListAdapter extends BaseExpandableListAdapter {

    //...

    @Override
    public View getChildView(int groupPosition, int childPosition,
            boolean isLastChild, View view, ViewGroup parent) {     
        ChildInfo childInfo = (ChildInfo) getChild(groupPosition, childPosition);
        if (view == null) {
            LayoutInflater infalInflater = (LayoutInflater) context
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            view = infalInflater.inflate(R.layout.prisustva_detaljno_child_row,
                    null);
        }

        Button delete = (Button) view.findViewById(R.id.delete);
        delete.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                RelativeLayout Rl = (RelativeLayout) v.getParent();
                TextView id = (TextView) Rl.findViewById(R.id.id_prisustvo);
                PrisustvaAdapter deleteByID = new PrisustvaAdapter(context);

                deleteByID.openToWrite();
                deleteByID.openToRead();
                deleteByID.deleteID(id .getText().toString()); …
Run Code Online (Sandbox Code Playgroud)

android expandablelistview notifydatasetchanged

4
推荐指数
1
解决办法
8698
查看次数

EditText自定义字符串格式

我搜索了与我的问题类似的每个问题,但没有得到它的工作.我的问题是:

我想在EditText输入时格式化一个字符串.格式是这(它总是一个19位数字):

012345 01 0123456789 0

如您所见,我想在用户输入时根据需要添加空格.我知道我必须使用TextWatcher但我所做的一切我都没有得到我想要的东西.

编辑:

这是我上次尝试的代码:

        @Override
        public void afterTextChanged(Editable s) {
           if(s.length() == 7 || s.length() == 10 || s.length() == 21){
                editText.removeTextChangedListener(this);
                String newValue;
                newValue= s.insert((s.length()-1), " ").toString();
                //Log.d("AFTER",newValue);
                editText.setText(newValue);
                editText.setSelection(newValue.length());
                editText.addTextChangedListener(this);
            }
        }
Run Code Online (Sandbox Code Playgroud)

format android android-edittext

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

列表活动Android的自定义布局

我知道有很多类似的问题,但我找不到能帮到我的答案,所以这是我的问题.我设法做到了这一点: 按原样

但我想要的是这个: 成为

所以我想在屏幕底部有一个固定按钮.我的布局是ListActivity的自定义布局,它看起来像这样:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >

<RelativeLayout
    android:id="@+id/relativeLayout1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_alignParentLeft="true"
    >
 <Button
    android:id="@+id/button1"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_weight="1"
    android:text="Delete" />

<TextView
    android:id="@+id/label"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_toRightOf="@+id/button1"
    android:text="@+id/label"
    android:gravity="center"
    android:textSize="20px" >
</TextView>

<ImageButton 
    android:id="@+id/rightArrow"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:background="@null"
    android:layout_alignParentRight="true"
    android:src="@drawable/right_arrow" 
    />
Run Code Online (Sandbox Code Playgroud)

android listactivity android-layout

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