我现在真的很沮丧..我想从Dropbox下载文件并将该文件保存到SDCARD ..我得到的代码为:
private boolean downloadDropboxFile(String dbPath, File localFile) throws IOException{
BufferedInputStream br = null;
BufferedOutputStream bw = null;
try {
if (!localFile.exists()) {
localFile.createNewFile(); //otherwise dropbox client will fail silently
}
FileDownload fd = api.getFileStream("dropbox", dbPath, null);
**br = new BufferedInputStream(fd.is);**
bw = new BufferedOutputStream(new FileOutputStream(localFile));
byte[] buffer = new byte[4096];
int read;
while (true) {
read = br.read(buffer);
if (read <= 0) {
break;
}
bw.write(buffer, 0, read);
}
} finally {
//in finally block:
if (bw != null) …
Run Code Online (Sandbox Code Playgroud) 有人知道"推送通知"和"拉通知"之间的区别是什么?
我知道"推送通知"是C2DM,但我不知道什么是"拉通知"
任何人请帮助..
在学习Java教程时,Reflection和Late Binding让我很困惑.在一些教程中,他们写过它们都是相同的,并且Reflection和Late Binding之间没有任何区别.但其他教程表示存在差异.
我很困惑,所以有人可以解释一下Java中的Reflection和Late Binding是什么,如果可行的话,请给我一些真实世界的例子.
谢谢..
我想创建一个视图,我可以从listview中选择多个项目,也可以并排更改所选列表项的颜色并将该项保存到我的arraylist中.我的列表如下所示:
但是当我以前滚动它时......它向我显示了另外一个项目,即使我没有选择它:
但我希望只有那个列表项颜色应该改变我点击的位置...
我使用的代码如下:
private class ItemsAdapter extends ArrayAdapter<String> {
List<String> items;
Context context;
private LayoutInflater inflater;
public ItemsAdapter(Context context, List<String> part_array_list) {
super( context, R.layout.part_list, R.id.label,part_array_list );
inflater = LayoutInflater.from(context) ;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
TextView textView ;
String item = (String) this.getItem( position );
if ( convertView == null ) {
convertView = inflater.inflate(R.layout.part_list, null);
// Find the child views.
textView = (TextView) convertView.findViewById( R.id.label );
// Optimization: Tag the row …
Run Code Online (Sandbox Code Playgroud) 我已经在google上研究了很多,并且还阅读了www.dropbox.com上提到的步骤,但我没有找到任何方法在我的应用程序中使用dropbox API列出dropbox的所有文件和文件夹..我知道如何下载来自Dropbox的文件以及如何将文件上传到Dropbox.
但是任何人都建议我这可以列出Dropbox的所有文件和文件夹,每当你点击任何文件,那么该文件开始下载并保存到你的SD卡.
任何人请帮我一些样品.... plsss
我使用以下代码在我的应用程序中使用印地语字体:
Typeface font = Typeface.createFromAsset(this.getAssets(), "fonts/DroidHindi.ttf");
txt.setTypeface(font);
Run Code Online (Sandbox Code Playgroud)
现在我想在用印地语编辑文本框中从用户那里获取输入.因此,需要印地语软键盘,任何人都可以指导我如何添加印地语软键盘吗?
我试图从过去12小时开始执行此任务,但仍然无法执行此操作...现在我将一个名为"testDatabase.db"的sqlite数据库文件作为备份文件放入SD卡中.现在我想要将数据库打开成电子表格格式,以便最终用户可以访问数据库并将此电子表格数据库存储到他的系统中,然后进一步打印输出和其他用途.
我研究了一些教程,其中写道,你可以先将你的数据库文件转换成XML,然后将这个文件导出为excel格式.
但我无法将我的数据库文件导出为XML格式...根据我的要求我想要按钮单击我的数据库文件应该转换为xml格式,以便最终用户可以使用它.
谢谢..
我正在开发一个应用程序,其中我使用数据库并将带有.db扩展名的数据库文件存储到SD卡中.现在我想将此"db文件转换为.csv",以便用户可以打开该.csv文件并且可以很容易看到它的所有数据......
我在文件名browse.xml中使用ListView,如下所示.
<ListView
android:id="@+id/listView1"
android:layout_width="250dp"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_below="@+id/relativeLayout1" >
</ListView>
Run Code Online (Sandbox Code Playgroud)
我在onCreate()方法中填充这个listView:
files1=new ArrayList<String>();
File sdcard=Environment.getExternalStorageDirectory();
files1 = getListFiles(new File(sdcard.getAbsolutePath()+File.separatorChar));
ArrayAdapter<String> fileList =new ArrayAdapter<String>(this, R.layout.row,files1);
setListAdapter(fileList);
Run Code Online (Sandbox Code Playgroud)
row.xml如下所示:
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rowtext"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:textSize="20dp"
android:textColor="#000000"
android:background="#FFFFFF"/>
Run Code Online (Sandbox Code Playgroud)
整个程序是在listView上显示sdcard的所有文件,点击任何listitem,将该文件名保存到sharedPrefernce ..现在我要更改ListView中的文件名(List items)的文本颜色在SharedPrefernce ..
[编辑]:这里使用ArrayAdapter默认构造函数列出listview中的所有项目
请给我一些建议......谢谢..
我在values-v11
文件夹中应用了以下代码
styles.xml
<style name="actionBarTheme" parent="android:Theme.Holo.Light">
<item name="android:actionOverflowButtonStyle">@style/MyActionButtonOverflow</item>
</style>
<style name="MyActionButtonOverflow" parent="@android:style/Widget.Holo.Light.ActionButton.Overflow">
<item name="android:src">@drawable/action_item_btn</item>
</style>
Run Code Online (Sandbox Code Playgroud)
但它没有改变溢出图标,这个主题中的所有其他项目工作正常但不是这一个,我错过了什么?