How to convert .doc file to .pdf file in android - android

Hi I am doing one application here I neeed to convert .doc file to pdf file,i tried but no idea any one did before please suggest me...thankyou
public class ShootAndCropActivity extends Activity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}

You might have good luck with this lib, available on GitHub. A how-to is presented in the article.

Related

Trying to Embed Cordova app into Native Android

When I try to follow the guide of Cordova to embed it into a native android application I can't build.
I use this guide:
https://cordova.apache.org/docs/en/latest/guide/platforms/android/webview.html
When I put everything in my main activity I receive an error on config.
It says can't resolve symbol 'config'. I have no clue what I am doing wrong or how to solve it.
onCreate
/* Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
cwv = (CordovaWebView) findViewById(R.id.tutorialView);
config.init(this);
cwv.loadUrl(config.getStartUrl());
}

How to provide path in File constructor in android?

I am trying to know whether the path I am mentioning is the path of file or folder.
Here is the code
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
File f=new File("F:/Office/A.txt");
boolean b=f.isFile();
Toast.makeText(this,""+b,Toast.LENGTH_LONG).show();
}
}
But it if giving false inspite of the fact that I am giving the right path. The same code in eclipse is giving true but in Android Studio is giving false. Why so?
try this:
String s = f.getAbsolutePath();'
then switch your Toast to this:
Toast.makeText(this, s,Toast.LENGTH_LONG).show();
that way the Toast will show you the path, and you can proceed from there

Custom Font Implemented with TypeFace method not changing

I've Read a lot of articles and stack Questions for over 4 hours, when i use this method to define a custom font i don't get any error but the font doesn't change?
My mainactivity.java is listed below
public class MyActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my);
TextView textView=(TextView)findViewById(R.id.myid);
Typeface typeface=Typeface.createFromAsset(getAssets(),"assets/fonts/Face Your Fears.ttf");
textView.setTypeface(typeface,Typeface.BOLD);
}
getAssets() gives path for your assets folder,so no need to write assets again
in "assets/fonts/Face Your Fears.ttf"
Try changing
Typeface typeface=Typeface.createFromAsset(getAssets(),"assets/fonts/Face Your Fears.ttf");
to
Typeface typeface=Typeface.createFromAsset(getAssets(),"fonts/Face Your Fears.ttf");
The complete example for same ttf file implementation is here Android Using External Fonts

Android - Is getResource() expensive?

if i need to use a resource twice, is it better to store it in a String?
public class Testing extends Activity{
private String c_stringName;
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
c_stringName= this.getString(R.string.name);
}
}
If you dig down to the machine. The only difference between them is 1 reference.
it may seem like running multiple
c_stringName= this.getString(R.string.name);
is doing alot of work but its is the same and storing it into a string reference.

Android prob to show pdf in webview

I am using android Webview to load a url to show a pdf file.
Here is my code:
public class TestProgectActivity extends Activity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WebView mtWebView=new WebView(this);
setContentView(mtWebView);
mtWebView.getSettings().setJavaScriptEnabled(true);
mtWebView.loadUrl("https://docs.google.com/viewer?url=http://www.cbwe.gov.in/HTMLEditor1/pdf/sample.pdf");
}
}
It is working for the link "https://docs.google.com/viewer?url=http://www.cbwe.gov.in/HTMLEditor1/pdf/sample.pdf".
But it is not working for "https://docs.google.com/viewer?url=http://www.pancreaze.net/pdf/PANCREAZE.pdf". When I am firing this url through Webview it is showing HTML content in the WebView instead of the actual pdf file. Here is the screenshot.
What is problem in my code?

Categories

Resources