actionview

Android: how to open image from gallery?

孤人 提交于 2020-01-14 15:27:32
问题 I've created a method in my app that saves my layout as an image and presents it in the gallery. I'm trying to open it but I'm having a hard time with all the tutorials and different approaches... This is my code: SimpleDateFormat mTimeFormat = new SimpleDateFormat("dd-MM-yyyy"); Date mTime = new Date(); String mStringTime = mTimeFormat.format(mTime); String fileFolder = "/orders"; String fileName = "/order-"+mStringTime; File filePath = new File("/sdcard"+fileFolder+fileName+".png"); Uri

Android: how to open image from gallery?

。_饼干妹妹 提交于 2020-01-14 15:26:18
问题 I've created a method in my app that saves my layout as an image and presents it in the gallery. I'm trying to open it but I'm having a hard time with all the tutorials and different approaches... This is my code: SimpleDateFormat mTimeFormat = new SimpleDateFormat("dd-MM-yyyy"); Date mTime = new Date(); String mStringTime = mTimeFormat.format(mTime); String fileFolder = "/orders"; String fileName = "/order-"+mStringTime; File filePath = new File("/sdcard"+fileFolder+fileName+".png"); Uri

Rails: Preselect a value in ActionView-Helper 'collection_select'

可紊 提交于 2020-01-03 11:31:11
问题 I'm trying to get the ActionView-Helper collection_select to take a value that will be preselected in the dropdown-menu. Neither ( :selected in the html-option-hash) <%= collection_select(:my_object, :my_method, @my_collection, :id, :description_string, {}, {:selected => @my_collection_object.id}) %> nor ( :selected in the option-hash) <%= collection_select(:my_object, :my_method, @my_collection, :id, :description_string, {:selected => @my_collection_object.id}, {}) %> seem to work. What am I

Rails 3 not loading HAML handler

懵懂的女人 提交于 2020-01-03 10:22:04
问题 I'm having some problems with Rails 3 and HAML in my application: for some reason Rails appears not to be loading the handler for dealing with haml files. Every action gives an error message similar to this one: Template is missing Missing template contact_search/index with {:formats=>[:html], :handlers=>[:rjs, :rhtml, :rxml, :builder, :erb], :locale=>[:en, :en]} in view paths "/var/www/osphonebook/app/views", "/var/www/osphonebook/vendor/bundle/ruby/1.8/gems/devise-1.3.4/app/views" Look at

Custom Action View can't be clicked

走远了吗. 提交于 2019-12-29 22:58:07
问题 I am trying to add a custom ActionView to my ActionBar . I am trying to add the common refresh button. ( ImageButton , ProgressBar inside a FrameLayout ) but if I use an ActionView onOptionsItemSelected() is never called. Here's the code: In my Activity : @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.messages_actionbar, menu); mRefreshView = (RefreshView) menu.findItem(R.id.messages_refresh).getActionView(); return

accessing current_user in mailboxer mailer notification

南笙酒味 提交于 2019-12-25 08:15:23
问题 I'm trying to print user name into a mail template which has been created via rails g mailboxer:views. Whenever I try to call the method, raises an "method or variable current_user not found", although public methods as User. id do prints. Here's the view <!DOCTYPE html> <html> <head> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" /> </head> <body> <h1>You have a new reply from <%= current_user.name %>: <%= @subject %></h1> <blockquote> <p> <%= raw @message.body %> </p> <

Creating a Blank Rails 3.1 Templating Handler

孤街浪徒 提交于 2019-12-24 01:01:42
问题 What I want to do is make it just output the view itself, and ignore what Rails would normally think is embedded Ruby within the HTML. For example: <div class="current"> <div class="question"> <h3 id="homework_name"><%= homework.name %><h3 id="due">Due <%= homework.due %></h3></h3> <h2 class="title">The Question:</h2> <p id="question_contents"class="contents"><%= current_question.contents</p> </div> <div class="answer"> <h2 class="title">Your Answer:</h2> <textarea class="contents" id=

How to trim leading whitespace with `<%=` in ERB templates in Rails that end up in `pre` elements?

自古美人都是妖i 提交于 2019-12-23 18:34:24
问题 (As far as I have researched here, this is not a duplicate question. Trimming spaces -- often trailing newlines -- is being discussed for <%- or -%> , but not for <%= . It could be a minor defect in Erubi template engine as well, the one being used by Rails for ERB templates.) I want to render / syntax-highlight code in a view, and my ERB view template contains: <p> <strong>Code:</strong> <pre class="highlight github"> <%= highlight(@code.code, @code.language) %> </pre> </p> The result is

How do I delegate to a model's to_builder method from a JBuilder view?

流过昼夜 提交于 2019-12-23 08:55:09
问题 Let's say I have a Person class and a Gang class class Person belongs_to :gang attr_accessible :name, :secret def to_builder Jbuilder.new do |app| person.id id person.name name end end end class Gang has_many :people attr_accessible :name end How do I use this to_builder method from a view? For example #app/views/gang/show.json.jbuilder (@gang set by the controller) json.gang do |json| json.name @gang.name json.gang_members(@gang.people) do |person| #how do I delegate to the person.to_builder

How to open a file in Android via an Intent

前提是你 提交于 2019-12-23 06:56:09
问题 how can I open a file that has been previously stored in the "privat" filesystem? The file is being downloaded by a webservice and should be stored on local fs. I got a "strange" error when trying to open the file via an Intent (Action_View). Although the file is present in the filesystem (saw the file in the file explorer in emulator/eclipse) it won't be shown in the calling galery activity that is launched. Instead of the picture the galery shows a black screen with not content in there