小编Var*_*oid的帖子

Android - 如何以编程方式跟踪设备上任何正在运行的应用程序的内存使用情况?

如何检查设备上当前正在运行的应用程序消耗了多少内存(RAM)?

谢谢.

memory android

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

Android - 如何使图标在触摸时发光?

如何在图标上获得蓝色发光效果?这有什么快速的方法吗?我真的不想使用photoshop来达到这种效果.

任何帮助将非常感激.

icons android touch glow

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

如何在用户退出应用程序时保存Android CheckBox的状态?

有什么办法可以在用户退出应用程序时保存我的复选框状态(已选中或未选中),这样我可以在应用程序重新启动时重新加载此状态?

@Override
public void onPause()
{

    super.onPause();
    save(itemChecked);
}
@Override
public void onResume()
{
    super.onResume();
    checkOld = load();

    for (int i = 0 ; i < checkOld.length; i++)
    {
        notes.ctv.get(i).setChecked(checkOld[i]);
    }
}
@Override
public void onRestart()
{
    super.onResume();
    checkOld = load();

    for (int i = 0 ; i < checkOld.length; i++)
    {
        notes.ctv.get(i).setChecked(checkOld[i]);
    }
}

private void save(final boolean[] isChecked) {
SharedPreferences sharedPreferences = getPreferences(Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
 insertState();
 for(Integer i = 0; i < isChecked.length; i++)
 {
     editor.putBoolean(i.toString(), …
Run Code Online (Sandbox Code Playgroud)

checkbox android exit reload savestate

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

Android - ClassCastException?

@Override
public void onPause()
{
    super.onPause();
    save(notes.itemSelected);
}
@Override
public void onResume()
{
    super.onResume();
    notes.itemSelected.clear();
    notes.itemSelected = load();

}
@Override
public void onRestart()
{
    super.onRestart();
    notes.itemSelected.clear();
    notes.itemSelected = load();

}

private void save(final ArrayList<String> isChecked) {
SharedPreferences sharedPreferences = getPreferences(Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
 for(Integer i = 0; i < isChecked.size(); i++)
 {
     editor.putString(i.toString(), isChecked.get(i));
 }
editor.commit();
}

private ArrayList<String> load() {
SharedPreferences sharedPreferences = getPreferences(Context.MODE_PRIVATE);
    ArrayList<String> reChecked = new ArrayList<String>();
    for(Integer i = 0; i < notes.getCount(); i++)
    { …
Run Code Online (Sandbox Code Playgroud)

android getstring classcastexception sharedpreferences

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

Heroku - 无法通过Play Framework应用程序设置postgres数据库?

我试图通过播放框架应用程序在heroku上设置postgres数据库,但我一直收到关于我的DATABASE_URL的错误.

堆栈跟踪: -

-----> Heroku receiving push
-----> Play 2.0 - Java app detected
-----> Running: sbt clean compile stage
       Getting net.java.dev.jna jna 3.2.3 ...
       :: retrieving :: org.scala-sbt#boot-jna
        confs: [default]
        1 artifacts copied, 0 already retrieved (838kB/25ms)
       Getting org.scala-tools.sbt sbt_2.9.1 0.11.2 ...
       :: retrieving :: org.scala-sbt#boot-app
        confs: [default]
        37 artifacts copied, 0 already retrieved (7324kB/78ms)
       Getting Scala 2.9.1 (for sbt)...
       :: retrieving :: org.scala-sbt#boot-scala
        confs: [default]
        4 artifacts copied, 0 already retrieved (19939kB/188ms)
       [info] Loading global plugins from /tmp/build_hdhsg4dgyxy/.sbt_home/.sbt/plugins …
Run Code Online (Sandbox Code Playgroud)

postgresql exception heroku playframework

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

Titanium是无bug的吗?它是否同样兼容开发iOS应用程序如XCode和Objective-c?

几天后,我是非常肯定钛是用于开发iOS应用,但在过去的几天里我曾经历约二几篇文章中消失了,一些文章指出钛是不是全功能的iOS开发,它是越野车一个伟大的IDE同样.

所以我来到我的StackOverflow朋友,知道这是真的吗?有人在使用Titanium开发iOS应用程序时确实遇到任何问题或遇到任何错误.

请告知我应该使用它还是应该使用Objective-C?

谢谢.

iphone titanium ios

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

iOS - 如何在视图控制器中创建导航栏项?

我一直在尝试创建一个导航栏后退按钮.

这是我的代码: -

UIBarButtonItem *barButton = [[[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonItemStyleBordered target:self action:nil]autorelease];
self.navigationItem.rightBarButtonItem = barButton;
Run Code Online (Sandbox Code Playgroud)

但它没有在导航栏上显示任何内容.

我使用的是UIViewController,而不是UINavigationController.

UINavigationController是实现这一目标的唯一方法吗?

任何帮助将非常感激.

任何好教程的链接都会很棒.

谢谢.

iphone uinavigationcontroller ios

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

Android - 如何通过单击应用程序图标来执行项目的主要功能?

我正在创建一个应用程序,只需单击其图标即可执行其主要功能.

换句话说,没有布局没有小部件只是它的工作.

用户单击图标后,应立即执行其主要功能.我想到的一种方法是将所有代码放在onCreate功能中.

或者,如果有任何其他方式,请与我分享.

layout icons android click

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

Android - 如何获取应用程序的图标?

我试图以这种方式显示任务列表 -

图标| ApplicationName | 复选框

因为我发现没有listview适配器支持这个,所以我决定开发一个自定义适配器,但我无法获取应用程序的图标.到目前为止我试过这个: -

public View getView(int position, View convertView, ViewGroup parent)
{
    View v = convertView;
    View row = inflater.inflate(R.layout.item, parent, false);
    CheckedTextView ctb = (CheckedTextView)row.findViewById(R.id.checkText);
    String pkgName = "com.abc.abc";

    ctb.setText("bla bla");
    ImageView iv = (ImageView)row.findViewById(R.id.image);
    List<PackageInfo> pkgs = activity.getPackageManager().getInstalledPackages(0);
    for(PackageInfo p : pkgs)
    {
       if(p.packageName.equals(pkgName))
       {
          Drawable d =  p.applicationInfo.loadIcon(pm);
           iv.setImageDrawable(d);
       }
    }

     return row;
}
}
Run Code Online (Sandbox Code Playgroud)

而且我确信我在这段代码中尝试了一些愚蠢的东西.请尽量抓住我做错的事.

谢谢.

checkbox icons android listview adapter

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

如何在Intent中添加set作为额外的?

我有一个类Prova类实现Serializable.我必须把这个Set放在一个意图中.这是代码:

Set<Prova> set=..... // Set is declared first and it's not null
Intent intent = new Intent(getApplicationContext(), Example.class);
intent.putExtra("set",set);
Run Code Online (Sandbox Code Playgroud)

这段代码给了我:"无法解析方法".有人可以帮帮我吗?

android android-intent

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

自动选择listview中的复选框 - android

我正在构建一个列表,列表中包含每个联系人的复选框,以选择要修改哪一个,例如,问题是当列表变得比电话屏幕更长并且滚动处于活动状态时; 当我选中一个复选框时,会在列表底部自动选择第二个复选框.

问题是自动选择第二个复选框; 请让我知道我该如何解决?

下面是我用于getView方法的代码

   public View getView(int position, View converView, ViewGroup parent){


   View row = converView;
   if(row == null){
   LayoutInflater inflater = getLayoutInflater();
   row = inflater.inflate(R.layout.edit, parent, false);
   }

   TextView label = (TextView)row.findViewById(R.id.label);
   label.setText(items[position]);

   CheckBox cb = (CheckBox)row.findViewById(R.id.del);

   ImageView icon = (ImageView)row.findViewById(R.id.icon);
   icon.setImageResource(images.get(position));

   Log.i("Pos", ""+position);


   return row;   
  } 
}
Run Code Online (Sandbox Code Playgroud)

checkbox android listview scroll

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

Android - notifyDataSetChanged()无法使用自定义适配器?

我试图调用notifyDataSetChanged()我的自定义适配器,但似乎没有工作.

这是我的活动: -

public class ThreadData extends ListActivity
{
private static final Uri SMS_URI = Uri.parse("content://sms");
HashMap<Long, BodyType> bodies = new HashMap<Long, BodyType>();
private String name, number;
private ListView listView;
private Activity activity;
ThreadDataAdapter adapter;
Handler handler;
private Context context;
private static final String PHONE_NUMBER_SEPARATORS = " ()-./";
static HashMap<String, ContactInfo.ContactDetail> info = new HashMap<String, ContactInfo.ContactDetail>();

public void onCreate(Bundle bundle)
{
    super.onCreate(bundle);
    setContentView(R.layout.chats);
    Bundle extras = getIntent().getExtras();
    activity = this;
    context = this;
    if(extras != null)
    {
        number …
Run Code Online (Sandbox Code Playgroud)

android adapter notify

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