小编ric*_*ick的帖子

从assets文件夹中读取pdf文件

public void DOCS(View btnDocs)
{   
    File fileBrochure = new File("android.resource://com.project.datastructure/assets/abc.pdf");
    if (!fileBrochure.exists())
    {
         CopyAssetsbrochure();
    } 

    /** PDF reader code */
    File file = new File("android.resource://com.project.datastructure/assets/abc.pdf");        

    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.fromFile(file),"application/pdf");
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    try 
    {
        getApplicationContext().startActivity(intent);
    } 
    catch (ActivityNotFoundException e) 
    {
         Toast.makeText(Stack_dr.this, "NO Pdf Viewer", Toast.LENGTH_SHORT).show();
    }
}
private void CopyAssetsbrochure() {
    AssetManager assetManager = getAssets();
    String[] files = null;
    try 
    {
        files = assetManager.list("");
    } 
    catch (IOException e){}
    for(int i=0; i<files.length; i++)
    {
        String fStr = files[i];
        if(fStr.equalsIgnoreCase("abc.pdf"))
        { …
Run Code Online (Sandbox Code Playgroud)

java android android-intent

24
推荐指数
3
解决办法
5万
查看次数

无法为java中的"final"变量赋值

 private void pushButtonActionPerformed(java.awt.event.ActionEvent evt)
{
    final int c=0;
    final JDialog d=new JDialog();
    JLabel l=new JLabel("Enter the Element :");
    JButton but1=new JButton("OK");
    JButton but2=new JButton("Cancel");
    final JTextField f=new JTextField(10);
    JPanel panel = new JPanel();
    but1.addActionListener(new ActionListener()
    {
        public void actionPerformed(ActionEvent e)
        {
            c=Integer.parseInt(f.getText());
            d.setVisible(false);
            d.dispose( );
        }
     });
but2.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e){
        d.setVisible(false);
        d.dispose( );
    }
});
}
Run Code Online (Sandbox Code Playgroud)

我正在使用netbeans 7.1.1.这是我的代码,我已将'c'声明为"final int",但行"c = Integer.parseInt(f.getText());" 我收到错误"无法为最终变量赋值".如果我从声明中删除单词final并将其作为"int c",那么在同一行中我得到一个错误"无法从类中访问局部变量c;需要声明为final".谁能告诉我为什么会这样?

java swing final

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

C++"cin"只读取第一个单词

#include<iostream.h>
#include<conio.h>
class String
{
    char str[100];
    public:
    void input()
    {
        cout<<"Enter string :";
        cin>>str;
    }

    void display()
    {
        cout<<str;
    }
};

int main()
{
     String s;
     s.input();
     s.display();
     return 0;
}
Run Code Online (Sandbox Code Playgroud)

我在Turbo C++ 4.5中工作.代码运行正常,但它没有给出所需的输出,例如,如果我将输入作为"steve hawking",则仅显示"steve".有人可以帮忙吗?

c++ java string

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

函数重载没有在C++中发生

我正在使用borland turbo C++编译器(4.5).这是我的代码,但我得到的错误如下:'time :: add(time)'的多个声明.这里我重载了add()三次错误来自第3次重载,即"void add(time) T1)".

 #include<iostream.h>
 #include<conio.h>
 class time
 {
 int h,m;
 public:
 void input()
 {
    cout<<"\n Enter hour :";
    cin>>h;
    cout<<"\n Enter min :";
    cin>>m;
 }
 void display()
 {
    cout<<"\n time is : "<<h<<":"<<m;
 }
 void add(time t1,time t2)
 {
    h=t1.h+t2.h+(t1.m+t2.m)/60;
    m=(t1.m+t2.m)%60;
 }
 time add(time t1)
 {
     time t3;
     t3.h=h+t1.h+(m+t1.m)/60;
     t3.m=(m+t3.m)%60;
     return t3;
 }
 void add(time t1)
 {
    h=h+t1.h+(m+t1.m)/60;
    m=(m+t1.m)%60;
 }
 };
 int main()
 {
    time t1,t2,t3;
    t1.input();
    t2.input();
    t3.add(t1,t2);
    t3.display();
    t3=t2.add(t1);
    t3.display();
    t2.add(t1);
    t2.display();
    return 0; …
Run Code Online (Sandbox Code Playgroud)

c++

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

制作带圆边的3D按钮

我正在开发一个网站,我想在其中实现带有圆边的3D按钮.所以我需要创建一个CSS文件.我搜索了很多关于3D按钮但是我还没有任何工作.

html css 3d button

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

在JAVA中初始化零数组为零

可能重复:
将所有数组元素初始化为零的任何快捷方式?

如何使用零来初始化普通的2D数组(所有shell应该没有存储)而不使用需要花费大量时间的旧循环方法.我的代码需要的东西应该花费很少的时间但是通过循环方法我的时间限制超过了.

java arrays time

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

在VB6中实现队列

Dim n, front, rear As Integer
Dim x As Integer
Dim arr() As Integer

Public Function init()
  n = InputBox("Enter size :")
  ReDim arr(n) As Integer
  front = 0
  rear = -1
End Function

Public Function insert(x As Integer)
  If rear = n-1 Then
    MsgBox "queue FULL !!!", vbOKOnly, "QUEUE"
  Else
    rear = rear + 1
    arr(rear) = x
    MsgBox x, vbOKOnly, "INSERTED"
  End If
End Function

Public Function delete() As Integer
  If rear + 1 = front Then
    MsgBox …
Run Code Online (Sandbox Code Playgroud)

vb6 queue

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

标签 统计

java ×4

c++ ×2

3d ×1

android ×1

android-intent ×1

arrays ×1

button ×1

css ×1

final ×1

html ×1

queue ×1

string ×1

swing ×1

time ×1

vb6 ×1